CURL receiving content data
| From: | Bruce Steinback | Date: | Fri, 24 Aug 2007 05:52:29 +0000 |
| Subject: | CURL receiving content data | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-261207@lists.php.net to get a copy of this message | ||
Hi all,
First thanks to the people that corrected my dumb mistake on XML parsing a few weeks ago, and
let's hope that this is as dumb.
I've got a mashup that when contacted attempts to gather feed info to mash into it's
response. I send a GET request (Atom request to be exact), and get the following back:
HTTP/1.0 200 OK Date: Thu 23 Aug 2007 21:27:48 GMT Server: Apache/2.0.54 (Unix) mod_ssl/2.0.54
OpenSSL/0.9.7e mod_jk/1.2.14 Content-Length: 222 Connection: close Content-Type:
application/atomsvc+xml;charset=UTF-8
but no Content data (the Atom XML response in the Content-Type).
Here's my code:
$checkBlogsUrl = "http://api.beta.blogs.aol.com/" . $owner .
"/service.xml";
$sessionRequest = curl_init();
curl_setopt( $sessionRequest, CURLOPT_URL, $checkBlogsUrl);
curl_setopt( $sessionRequest, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $sessionRequest, CURLOPT_REFERER, $baseUrl . "loginresp-blogs.php");
$header[] = "X-AOL-DEVID: " . $devId;
$header[] = "Authorization=OpenAuth token: " . $token;
curl_setopt( $sessionRequest, CURLOPT_HTTPHEADER, $header);
curl_setopt( $sessionRequest, CURLOPT_HEADER, 1);
$responseBase = curl_exec( $sessionRequest );
// $responseXml = curl_multi_getcontent($sessionRequest);
print "<br/>" . $responseBase;
As you can see, I tried curl_multi_content hoping it might be for like multiple content, but in
reviewing the spec, it's obviously for aggregating multiple requests.
There's definitely content there, you can try:
http://api.beta.blogs.aol.com/bsteinback0224/service.xml
to see it. And the Content-Length figure looks about right (it was 847 for bsteinback0224, which
was pretty close to the file size when I saved it).
I can find dozens of examples of adding POST Content, but none for reading file content. Please
don't tell me it can't be done :-(
Thanks,
Bruce
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell.
http://searchmarketing.yahoo.com/