You are here: Re: posting with cURL problem « PHP Programming Language « IT news, forums, messages
Re: posting with cURL problem

Posted by zorro on 12/29/06 20:45

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация