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 of curl_exec() instead of outputting out directly.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -