cURL code in PHP dumps output to the page

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().

Leave a Comment