Wednesday, March 28, 2012

Return HTTP Status Code Only From CURL Call

<?php
$url = 'yoururl';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

?>

No comments:

Post a Comment