gpt4 book ai didi

php - Curl post请求不返回数据

转载 作者:行者123 更新时间:2023-11-30 00:29:22 24 4
gpt4 key购买 nike

您好,我正在使用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"}

最佳答案

根据the manual ,当CURLOPT_RETURNTRANSFER设置为TRUE时,调用curl_exec()时将返回结果。如果为 FALSE,则将只是输出,而 curl_exec() 不返回结果。

但是,如果您将 CURLOPT_RETURNTRANSFER 设置为 FALSE 并且 curl_exec() 仍然返回字符串而不是 bool 值,那就是另一个故事了(不过不应该发生) .

关于php - Curl post请求不返回数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22630736/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com