卷曲请求而不返回数据

时间:2014-03-25 09:47:08

标签: php mysql curl

您好我使用了一个curl post我不知道为什么我仍然会在我将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"}

1 个答案:

答案 0 :(得分:0)

根据the manual,当CURLOPT_RETURNTRANSFER设置为TRUE时,将在调用curl_exec()时返回结果。如果它为FALSE,那么只需输出curl_exec()就不会返回结果。

但是,如果你将CURLOPT_RETURNTRANSFER设置为FALSE并且curl_exec()仍然返回一个字符串而不是一个布尔值,那就是另一个故事(尽管不应该发生)。 / p>

相关问题