Any way I'm getting the error curl_getinfo(): 20 is not a valid cURL handle resource on line 21 which is line 14 here. I'm not sure why and this feature isn't exactly well documented. On the up side of things I was able to have my script identify itself by setting a useragent so I don't look like a spammer.
Code: Select all
function check_css_compliance($css)
{
$agent = 'JAB Creations Remote CSS Validator 1.0; Validated by: http://'.$_SERVER['SERVER_NAME'];
$referer = $css;
$ch = curl_init('http://jigsaw.w3.org/css-validator/validator?uri='.$path_public.'_cache/'.session_id().'.css');
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);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_code == '200') {$function_result = '200';}
else if ($http_code == '500') {$function_result = '500';}