No sé si has trabajado antes con cUrl, pero te pongo un ejemplo tonto para que veas mas o menos un ejemplo y setear las opciones a tu gusto, este ejemplo checka si un server está on u off
Código PHP:
Ver originalpublic static function checkServer (){
$domain = parent::$BMUrl;
//init curl
//set curlopt
// dont verify ssl-cert
//close curl
$str = "";
foreach($headers AS $k=>$v){
}
$msg=($headers['http_code']>= 200) && ($headers['http_code'] < 300)?"CheckServer::TRUE - Server returned\n\n".$str:"CheckServer::FALSE - Server returned\n\n".$str;
//returning values and saving a log response
if (($headers['http_code']>= 200) && ($headers['http_code'] < 300)){
genMsg(0,$msg, __FILE__, __FUNCTION__, __LINE__);
return true;
}
else if ($headers['http_code'] >= 300){
genErrorMsg(1,$msg, __FILE__, __FUNCTION__, __LINE__);
return false;
}
else{
genErrorMsg(2,$msg, __FILE__, __FUNCTION__, __LINE__);
return false;
}
}