curl-and-php
PHP/CURL: Sending Cookie to return JSON from Server
Date: Sun, 5 Sep 2010 05:45:11 +0530 (IST)
Hi,
I m working on cURL and PHP and facing an issue with setting the cookie correctly. I have to send a facebook cookie to a server which will then return JSON. It works fine if you access it through the browser, but if you access it through PHP cURL code it returns an HTTP respone code of 500 which is Internal Server Error.
Please help in any way you can, below is the code snippet I m using:
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, '<server url>');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, "/fbs_<app id>");
$result = curl_exec($ch);
echo $result;
echo "\n\ncURL error number:" .curl_errno($ch);
?><br/><?php
echo
"\n\ncURL error:" . curl_error($ch);
curl_close($ch);
cURL error number returns 0, the error message is blank.
Thanks & Regards,
-Fahd
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2010-09-05