【发布时间】:2014-03-25 09:47:08
【问题描述】:
您好,我正在使用 curl 帖子,如果我将 CURLOPT_RETURNTRANSFER 设置为 0 或 false,我不知道为什么我仍然会收到返回的数据。
这是我的代码:
<?php
$url = 'https://graph.facebook.com/?id=http://twingoo.ro/profil.php?user='.$user.'&scrape=true';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 0);
$response = curl_exec($ch);
curl_close($ch);
?>
返回结果:
{"url":"http:\/\/twingoo.ro\/profil.php?user=53","type":"website","title":"Stan Elena","image":[{"url":"http:\/\/twingoo.ro\/images\/users\/53\/Hydrangeas.jpg"}],"description":"Acesta este profilul meu pe twingoo.ro, intra si voteaza-ma pentru a putea castiga un super premiu!\nTe poti inscrie si tu gratuit pe twingoo.ro alaturi de mine.\nTwingoo Social Group powered by Websoftit.ro","site_name":"Twingoo","see_also":["http:\/\/www.twingoo.ro\/"],"updated_time":"2014-03-25T10:10:14+0000","admins":[{"id":"xxxxxxxxxxxxxxxxxxxxxx","name":"Sima Cristian Alexandru","url":"http:\/\/www.facebook.com\/sima.cristianalexandru"}],"id":"xxxxxxxxxxxxxxxxxxx"}
【问题讨论】:
-
你的脚本有错误; 'curl_setopt($curl,' 应该是 'curl_setopt($ch,'
-
true,我将其更改为 sh,但它仍然返回结果:(