I found this class in the PHP documentation, and edited it a bit. It works
for me, getting the header and the body separately. You may want to
experiment with the "<html" string position to cut the curl response up
with.
class CCurl {
var $m_handle;
var $m_header;
var $m_body;
var $m_info;
function CCurl($sUrl) {
$this->m_handle = curl_init();
curl_setopt($this->m_handle, CURLOPT_URL, $sUrl);
return;
}
function setOpt($sOpt, $sVal) {
curl_setopt($this->m_handle, $sOpt, $sVal);
return;
}
function getHeader() {
return $this->m_header;
}
function execute() {
$sResponse = curl_exec($this->m_handle);
$this->m_body = substr($sResponse, strpos($sResponse, "<html"));
$this->m_header = substr($sResponse, 0, -strlen($this->m_body));
return $this->m_body;
}
function getInfo() {
return $this->m_info = curl_getinfo($this->m_handle);
}
function close() {
curl_close($this->m_handle);
return;
}
}
"Ron Croonenberg" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> I am working on an app with php and MySQL but I have a curl question if
> you don't mind.
>
> I need to check a url (from the db) but I want the get the header info
> first. now what i want is exactly what "curl -I "http://........"
> outputs.
>
> I am trying to write a php script that produces the same output, but it
> seems to break (that pesky segment fault again)
>
> any ideas ?
>
> thanks,
>
> Ron
>
>
>
>
> --
> =================================================================
> It's is not, it isn't ain't, and it's it's, not its, if you mean
> it is. If you don't, it's its. Then too, it's hers. It isn't
> her's. It isn't our's either. It's ours, and likewise yours and
> theirs.
> -- Oxford Uni Press
> =================================================================
> Ron Croonenberg |
> | Phone: 1 765 658 4761
> Lab Instructor & | Fax: 1 765 658 4732
> Technology Coordinator |
> |
> Department of Computer Science | e-mail: [EMAIL PROTECTED]
> DePauw University |
> 275 Julian Science & Math Center |
> 602 South College Ave. |
> Greencastle, IN 46135 |
> =================================================================
> http://www.csc.depauw.edu/RonCroonenberg.html
> =================================================================
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php