Don't Echo Out cURL

前端 未结 3 1264

When I use this code:

$ch = curl_init($url);
$statuses = curl_exec($ch);
curl_close($ch);

I am returned what I want, but if I just use that - <

相关标签:
3条回答
  • 2021-01-31 07:12

    Include this option before curl_exec()

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
    0 讨论(0)
  • 2021-01-31 07:34

    Put this on line 2:

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
    0 讨论(0)
  • 2021-01-31 07:35

    In addition to the accepted answer, make sure you didn't set CURLOPT_VERBOSE to true, if you add this

    curl_setopt($ch, CURLOPT_VERBOSE, true );
    

    there will be output from cUrl, even with CURL_RETURNTRANSFER set to true

    0 讨论(0)
提交回复
热议问题