Hi all,

I' ve problem sending HTTP POST(multipart/form-data) request using CURL. The server always reply with HTTP/1.1 417 Expectation Failed. Then I review my code and the tcp packet using wireshark for long long time sad.gif just to figure out where is the error!. This problem only for one site and for the others site my script works perfectly!.

here is my packet that sent to the server
CODE
POST xxxxxxxx HTTP/1.1
Cookie: PHPSESSID=447c6f5c9e73c22a1bf50dd46940306e
Host: www.xxxxxxxxxx.com
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.xxxxxx.com/
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Content-Length: 1096
Expect: 100-continue
(anti-spam-content-type:) multipart/form-data; boundary=----------------------------14293c2adb1d

<< THE DATA >>


And here is the server response
CODE
HTTP/1.1 417 Expectation Failed
Connection: close
Content-Length: 0
Date: Tue, 30 Jan 2007 07:19:41 GMT
Server: lighttpd/1.4.8
Connection: close
Content-Length: 0
Date: Tue, 30 Jan 2007 07:19:41 GMT
Server: lighttpd/1.4.8


After googling for while, i found that the error is not on my code but the server(lighttpd) bug. Based on Daniel Stenberg(http://curl.haxx.se/mail/archive-2005-11/0127.html) we have to remove header (Expect: 100-continue) using command -H "Expect: ". Yeah but it's for curl executable, how to doit on PHP/CURL?. If set up curl_setopt($ch, CURLOPT_POSTFIELDS, $foo) PHP curl always sent Expect Header. I've searching everywhere but i couldn't find useful help. Any body knows what PHP/CURL command to remove certain header that we specified?

Thanks

Rio Astamal smile.gif

 

 

 


Comment/Reply (w/o sign-up)