note 78654 deleted from function.curl-exec by danbrown
| From: | danbrown@php.net | Date: | Mon, 04 Jan 2010 21:38:12 +0000 |
| Subject: | note 78654 deleted from function.curl-exec by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164644@lists.php.net to get a copy of this message | ||
Note Submitter: cameron at bulock dot com
----
A slightly more efficient way to return the HTTP code would be to use the curl_getinfo function
function getHttpResponseCode($url)
{
$ch = @curl_init($url);
@curl_setopt($ch, CURLOPT_HEADER, TRUE);
@curl_setopt($ch, CURLOPT_NOBODY, TRUE);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$status = array();
$status = @curl_getinfo($ch);
return $status['http_code'];
}