curl-and-php
Getting the http headers into a separate variable
Date: Fri, 21 Jul 2006 21:22:37 -0500
Hello all,
I am trying to obtain both the header data and the content of a curl
request using the following function:
<?php
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "http://testsite.int");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HEADER,1);
$result = curl_exec ($curl);
curl_close ($curl);
print $result;
?>
The CURLOPT_HEADER writes the header as part of the regular output. I
believe an alternative CURLOPT_WRITEHEADER can write to file, for then
reading the file again, however I would assume there must be a way to
get the data right into a variable. What is the best way for doing this?
Best regards,
Kenneth
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2006-07-22