note 71787 added to function.curl-setopt
| From: | Jamolkhon at osu1 dot php dot net | Date: | Fri, 15 Dec 2006 19:11:37 +0000 |
| Subject: | note 71787 added to function.curl-setopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120642@lists.php.net to get a copy of this message | ||
in response to "brett at brettbrewer dot com":
another useful way of getting headers without using regular expression
<?php
class CCurl {
var $m_handle;
var $m_header;
var $m_body;
function CCurl($sUrl) {
$this->m_handle = curl_init();
curl_setopt($this->m_handle, CURLOPT_URL, $sUrl);
curl_setopt($this->m_handle, CURLOPT_HEADER, 1);
curl_setopt($this->m_handle, CURLOPT_RETURNTRANSFER, 1);
return;
}
function getHeader() {
return $this->m_header;
}
function execute() {
$sResponse = curl_exec($this->m_handle);
$this->m_body = substr($sResponse, strpos($sResponse, "\r\n\r\n") + 4);
$this->m_header = substr($sResponse, 0, -strlen($this->m_body));
return $this->m_body;
}
function close() {
curl_close($this->m_handle);
return;
}
}
?>
(you can add something or make some changes to suit your needs)
----
Server IP: 66.163.161.117
Probable Submitter: 83.69.139.10
----
Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php
Edit -- https://master.php.net/note/edit/71787
Del: integrated -- https://master.php.net/note/delete/71787/integrated
Del: useless -- https://master.php.net/note/delete/71787/useless
Del: bad code -- https://master.php.net/note/delete/71787/bad+code
Del: spam -- https://master.php.net/note/delete/71787/spam
Del: non-english -- https://master.php.net/note/delete/71787/non-english
Del: in docs -- https://master.php.net/note/delete/71787/in+docs
Del: other reasons-- https://master.php.net/note/delete/71787
Reject -- https://master.php.net/note/reject/71787
Search -- https://master.php.net/manage/user-notes.php