[RESOLVED] Curl error
There is a site to which I wana submit postdata using PHP with curl.
I get this error:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>406 Not Acceptable</TITLE>
</HEAD>
<BODY>
<H1>Not Acceptable</H1>
An appropriate representation of the requested resource / could not be found on this server.
<P> <HR> <ADDRESS>
Apache/1.3.37 Server at www.test.com Port 80
</ADDRESS> </BODY>
</HTML>
But when I do it manually with FF browser all is well then!
I never saw this kind of error.
What should I modify in curl?
[719 byte] By [
Ipsens] at [2007-11-20 7:28:13]

# 1 Re: [RESOLVED] Curl error
I did catch headers that ny browser sends
http://www.test.com/?a=details&lid=149
POST /?a=details&lid=149 HTTP/1.1
Host: www.test.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
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.test.com/?a=details&lid=149
Cookie: HLSID=7a6339cb17994c4e0ba3ed214d4447b0
Content-Type: application/x-www-form-urlencoded
Content-Length: 58
a=add_this&action=save&lid=149&email=test%40yahoo.com
And it response with:
HTTP/1.x 302 Found
Date: Sun, 29 Apr 2007 15:36:52 GMT
Server: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.6 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a
X-Powered-By: PHP/4.4.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: ?a=add_vote&lid=149&display=fails
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
Now I wanted to see which headers is curl sending
Only option I did found was:
"CURLINFO_HEADER_OUT" - The request string sent. Available since PHP 6.0.0
$info = curl_getinfo($ch, CURLINFO_HEADER_OUT);
Which resulted in false because only PHP 6 supports it.
So how am I supposed to compare them if I can't see both of them? :confused:
Ipsens at 2007-11-10 3:56:34 >

# 3 Re: [RESOLVED] Curl error
No no no...
I use PHP 5.2.1 so it is normal and expected that I did get false.
That is not questionable!
Second... I did resolved it.
I needed to remove
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
from function I did use for posting at many many places on internet.
Reason it didn't worke don this one aite and did on all others is its aggressive appache settings.
Soon after posting data to page, you get response page which contains result.
Above line in php function forced second step which is get to be commited like post
so because of aggressive appache settings it was stoped while it did passed at other "flexibile" servers.
Ipsens at 2007-11-10 3:58:30 >
