function nxs_cURLTest($url, $msg, $testText) { echo "<br/>--== Test Requested ... " . $url . "<br/>"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); $response = curl_exec($ch); $errmsg = curl_error($ch); $cInfo = curl_getinfo($ch); curl_close($ch); echo "Testing ... " . $url . " - " . $cInfo['url'] . "<br/>"; if (stripos($response, $testText) !== false) { echo "...." . $msg . " - OK<br/>"; } else { echo "....<b style='color:red;'>" . $msg . " - Problem</b><br/>"; prr($response); prr($errmsg); prr($cInfo); echo nxs_cURLTestCode($url); } }
function nxs_cURLTest($url, $msg, $testText) { echo "<br/>--== Test Requested ... " . $url . "<br/>"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.39 Safari/537.36"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); $response = curl_exec($ch); $errmsg = curl_error($ch); $cInfo = curl_getinfo($ch); curl_close($ch); echo "Testing ... " . $url . " - " . $cInfo['url'] . "<br/>"; if (stripos($response, $testText) !== false) { echo "...." . $msg . " - OK<br/>"; } else { echo "....<b style='color:red;'>" . $msg . " - Problem</b><br/>"; prr($response); prr($errmsg); prr($cInfo); echo nxs_cURLTestCode($url); } }