note 78654 added to function.curl-exec
| From: | cameron at bulock dot com | Date: | Mon, 22 Oct 2007 05:14:23 +0000 |
| Subject: | note 78654 added to function.curl-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131619@lists.php.net to get a copy of this message | ||
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'];
}
----
Server IP: 216.235.15.211
Probable Submitter: 71.206.111.161
----
Manual Page -- http://www.php.net/manual/en/function.curl-exec.php
Edit -- https://master.php.net/note/edit/78654
Del: integrated -- https://master.php.net/note/delete/78654/integrated
Del: useless -- https://master.php.net/note/delete/78654/useless
Del: bad code -- https://master.php.net/note/delete/78654/bad+code
Del: spam -- https://master.php.net/note/delete/78654/spam
Del: non-english -- https://master.php.net/note/delete/78654/non-english
Del: in docs -- https://master.php.net/note/delete/78654/in+docs
Del: other reasons-- https://master.php.net/note/delete/78654
Reject -- https://master.php.net/note/reject/78654
Search -- https://master.php.net/manage/user-notes.php