ssl_verify_result has a value of 20 , which means, according to the documentation:
Failed to get local issuer certificate
certificate issuer certificate found locally not found. This usually means that the list of trusted certificates is not complete.
You can try without checking the peer:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
If this works, you will need to specify the path to the recent CA set. See Also: http://curl.haxx.se/docs/sslcerts.html
You should also check if the file you are trying to download is in the expected folder. If you specify CURLOPT_VERBOSE = 1 , it should also warn you about this.
Update
After checking the API documentation, the service does not expect a regular download of the file (ie "multipart/form-data" ); rather, a raw boot is required.
This can be done:
curl_setopt($ch, CURLOPT_POSTFIELDS, file_get_contents('myPicture.jpg')); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: image/jpeg"));
Update 2 Passing something using CURLOPT_POSTFIELDS implicitly sets the POST and Content-Type request method to application/x-www-form-urlencoded . When you pass an array, the values โโcan start with @ to indicate the file is loading (this should also implicitly change the Content-Type to multipart/form-data ).
The curl command line allows @ in several places:
- using
--data-binary to specify a file containing raw binary data - using
--data or --data-ascii to specify a file containing url encoded data. - using
--F or --form
The latter behaves the same as passing an array to CURLOPT_POSTFIELDS and using the @ prefix. The other two behave in the same way as passing a string.