0

i try to save out of curl result to sql but it's not work

 $Curl_Session = curl_init('https://graph.facebook.com/xxxxxxxxxx/feed');
 curl_setopt ($Curl_Session, CURLOPT_POST, 1);
 curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, "access_token=$ad7kfarfish&message=$message");
 curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
 $a8=curl_exec ($Curl_Session);
 curl_close ($Curl_Session);

i try every thing

i try

 $Curl_Session = curl_init('https://graph.facebook.com/xxxxxxxxxx/feed');
 curl_setopt ($Curl_Session, CURLOPT_POST, 1);
   $a8=curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, "access_token=$ad7kfarfish&message=$message");
 curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
curl_exec ($Curl_Session);
curl_close ($Curl_Session);
4

2 回答 2

0

如果要将响应放入变量中,则需要执行以下操作:

curl_setopt($Curl_Session, CURLOPT_RETURNTRANSFER, 1);
$a8 = curl_exec($Curl_Session);

如果没有此选项,则响应将传递给客户端(除非您使用CURLOPT_FILE,它将其放入文件中)。

于 2013-09-11T21:03:32.197 回答
0

您需要告诉 cURL 返回传输:curl_setopt($Curl_Session,CURLOPT_RETURNTRANSFER,1);

然后保存响应: $response = curl_exec($Curl_Session);

于 2013-09-11T21:04:44.797 回答