php - curl_exec printing results when I don't want to -
i using following code:
$ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_timeout, 12); $result = curl_exec($ch); curl_close ($ch);
however it's printing results straight away. possible put json result variable can print out when want to?
set curlopt_returntransfer
option:
// ... curl_setopt($ch, curlopt_returntransfer, true); $result = curl_exec($ch);
per the docs:
curlopt_returntransfer
-true
return transfer string of return value ofcurl_exec()
instead of outputting out directly.
Comments
Post a Comment