Translating cURL command to PHP Translating cURL command to PHP curl curl

Translating cURL command to PHP


Try getting rid of the header "Content-Type: multipart/form" from your CURLOPT_HTTPHEADER option as cURL will take care of this for you based on your post data.

Since you are uploading a file, the content-type will automatically be set to multipart/form-data which is actually the correct content type, not multipart/form.


curl -k means insecure. Add the following line:

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

Translated from the german manual (Note that the english version is missing this information):

If CURLOPT_SSL_VERIFYPEER has been deactivated, the option CURLOPT_SSL_VERIFYHOST has to be disabled as well.

The rest of your code should work fine.