I am using the following code:
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 12); $result = curl_exec($ch);
Set CURLOPT_RETURNTRANSFER option:
CURLOPT_RETURNTRANSFER
// ... curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $result = curl_exec($ch);
Per the docs:
CURLOPT_RETURNTRANSFER - TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.
TRUE
curl_exec()