我尝试将curl结果保存到sql但它无法正常工作
$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);
我尝试每件事
我试试
$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);
答案 0 :(得分:0)
如果您希望将响应放入变量中,则需要执行以下操作:
curl_setopt($Curl_Session, CURLOPT_RETURNTRANSFER, 1);
$a8 = curl_exec($Curl_Session);
如果没有此选项,响应将传递给客户端(除非您使用CURLOPT_FILE
,将其放入文件中)。
答案 1 :(得分:0)
您需要告诉cURL返回转移:curl_setopt($Curl_Session,CURLOPT_RETURNTRANSFER,1);
然后保存响应:
$response = curl_exec($Curl_Session);