I'm merely attempting to get the HTTP code (200, 500, 404, 403, etc). However I get the error not a valid cURL handle resource. If I replace $ch with curl_init('http://w3.org/') then all I get is '0' which means it failed. Could someone please help clarify what is going on?
PHP Code:<?php
$agent = 'JAB Creations Remote CSS Validator 1.0; Validated by: http://'.$_SERVER['SERVER_NAME'];
$ch = curl_init('http://w3.org/');
curl_setopt($ch,CURLOPT_USERAGENT, $agent);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_REFERER,$referer);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch,CURLOPT_TIMEOUT,10);
$output = curl_exec($ch);
curl_close($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo $httpcode;
?>




Reply With Quote
Bookmarks