Problems with Curl and POST
| From: | mbneto | Date: | Mon, 16 Apr 2007 21:43:50 +0000 |
| Subject: | Problems with Curl and POST | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-253058@lists.php.net to get a copy of this message | ||
Hi,
I am tring to use curl to access, via POST, a remote 'service'. I'vemanaged to test it fine but when I use real data to feed the curl it gives me strange results. When I check the logs of the remote web server one thing that alarms me is that with test data I see A.B.C.D - - [16/Apr/2007:17:41:53 -0400] "POST /service.php HTTP/1.1" 200 61 with real data (using the same script) A.B.C.D - - [16/Apr/2007:17:48:55 -0400] "HEAD /service.php HTTP/1.1" 200 - After reading the user contributed notes I found that it must be related with encoding. But even if I use the suggested code
$o=""; foreach ($post_data as $k=>$v)
{ $o.=
"$k=".utf8_encode($v)."&"; }
$post_data=substr($o,0,-1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);I get the same results. Any tips? php 5.0.4