cURL and PHP displaying "1"

CURLOPT_RETURNTRANSFER shoud be TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.read the full documentation php.net

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

or you can do

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

You need to use CURLOPT_RETURNTRANSFE or curl_exec returns a statuscode and sends the response to stdout:

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

Use the CURLOPT_RETURNTRANSFER option. Otherwise cURL will automatically echo the data and just return true (which is converted to 1 by echo).

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

PHP.net says,

TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it directly.