Re: posting with cURL problem




zorro wrote:
Ok I found the reason, hope this helps someone eventually:

You can see headers sent by cURL by using

$mydebug = fopen('debug.txt','w');
curl_setopt($curl, CURLOPT_STDERR, $mydebug);
curl_setopt($curl, CURLOPT_VERBOSE, 1);

I noticed those headers were different when posting with an array.
Namely, there is a "Expect: 100-continue header" which basically tells
the server that some content will be posted but only if the server
responds back with "HTTP/1.1 100 Continue" code. Why on the web site I
was posting to the continuing doesn't happen automatically like on my
testing servers i don't know. I tried setting headers like "Connection:
keep-alive" but it didn't help. What did work though was removing the
"Expect" header :

curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));

So now cURL doesn't ask permission to post first but just posts
directly.
thank you for noticing that

.



Relevant Pages

  • Re: [PHP] I need help with PHP, cURL, and POST
    ... of the cURL stuff. ... It tells you that you are not "proving" to the server that you are a ... option that lets you see the other headers. ... look at what a Cookie actually looks like in the headers. ...
    (php.general)
  • Re: getting pages with curl
    ... install Fiddler, check headers, recreate with cURL, violá. ...
    (comp.lang.php)
  • Re: rest-client get header only
    ... be able work out how to get just the HEAD of a URL. ... i.e. in curl I would: ... :headers => headers) ...
    (comp.lang.ruby)
  • Re: Fill a form authenticated HTTPS
    ... > and I scare it cause problems with curl.. ... sniff the headers while manually login to the URL ... <?php echo 'Just another PHP saint'; ...
    (comp.lang.php)
  • Re: posting with cURL problem
    ... I noticed those headers were different when posting with an array. ... the server that some content will be posted but only if the server ... So now cURL doesn't ask permission to post first but just posts ...
    (comp.lang.php)