Don't Echo Out cURL

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 - $statuses is echoed out onto the page.

How can I stop this?


Solution 1:

Put this on line 2:

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

Solution 2:

Include this option before curl_exec()

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);