Managing curl output in php

Solution 1:

Use this option to curl_setopt():

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

This will make curl_exec return the data instead of outputting it.

To see if it was successful you can then check $result and also curl_error().

Solution 2:

Also make sure to turn off this option:

curl_setopt($ch, CURLOPT_VERBOSE, 0);       

Or else it will still print everything to screen.