I\'m running into a rather strange issue.
I\'m trying to log into a remote moodle install using curl from PHP.
I have a curl command, which works perfectly in th
Most likely your problem is related to HTTP header Expect: 100-continue
that cURL sends by default for each POST request.
The Expect: 100-continue
header is used in POST requests containing big data when client is not sure that server will accept such request. In this case client first sends request with only headers including Expect: 100-continue
and, if the server's response is successful, send the same request with body (POST data).
The problem is that not all web servers handle this header correctly. In such cases sending this header is undesired.
The solution is manually remove Expect
header from sending headers by passing array('Expect:')
to CURLOPT_HTTPHEADER
option.
In your case you can simply add 'Expect:' string to $headers
array:
$headers[] = 'Expect:';