Remove:
fwrite($fp, $data);
When you use CURLOPT_FILE
, cURL writes the results to the file, you don't need to do it yourself. $data
contains true
, and you're appending that to the file (actually you're appending 1
to the file, since you're converting true
to a string when you write it).