posting with cURL - postfields array won't work



Hello,

I'm really stumped about this one. The problem below happens when i'm
posting to a particular web site but there's no problem when I post to
my online testing server.

this works for both the web site and my testing server:
curl_setopt($curl, CURLOPT_POSTFIELDS, "clown=bozo" );

this works only for my testing server:
curl_setopt($curl, CURLOPT_POSTFIELDS, array('clown'=>'bozo') );

In this case the response from the web site is empty, no headers,
nothing, and there is no cURL error.


I need to use an array for the postfields because I will eventually be
uploading a file thusly:
array('myfile'=>''@c:/images/clowns/bozo.gif").

I searched the web and all I could find was some people append "\n" to
the posted values, so i tried that but to no avail:
array('clown'=>"bozo\n")


the full code:

$curl = curl_init();

$cookiejar =
$_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF']).'/cookiejar.txt';
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookiejar );
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookiejar );
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows
NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_MAXREDIRS, 2);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, array('clown'=>'bozo') );

curl_setopt($curl, CURLOPT_URL, 'http://www.somesite.com/form.htm');
$response = curl_exec($curl);

echo $response;

.



Relevant Pages

  • Re: Fun With AT&T
    ... I am trying to order new telephone service via your web site. ... If this response does not address your concern, ... Your AT&T Customer Service Representative ... Make sure to close all Internet Explorer windows ...
    (misc.consumers)
  • Re: A message to Self-Appointed-NewsGroup-Netiquette-Enforcers... PLEASE LEAVE US AL
    ... > First, of all, in my response to this sub thread, I've trimmed the ... > specifically quote to defend yourself. ... my sig has to do with quoting favourite things my pet quaker and grey ... > saying clearly "Hello?") and the web site URL is to do with adults playing ...
    (comp.databases.ms-access)
  • Re: new, and very, very ugly
    ... Hey, just received this from National, in response to my comment to ... Unspeakably hideous and repulsive web site. ... You go key account, eventually that leads to rock-bottom such as automotive, then you get squeezed along the lines of "Our researchers have determined that you are making 8% profit margin on these parts. ...
    (sci.electronics.design)
  • Re: Mark Clayton.....are you ignoring me???
    ... called and e-mailed with no response and or around that same time he ... Purchased through pinballpal.com web site the "Only 1 Left" Gottlieb ... You may return any item ordered through this web site for a refund ... care of me as a customer and how I should proceed. ...
    (rec.games.pinball)
  • Re: After upgrading to SPS, cant access a WSS site
    ... Is companyweb also the machine name or did you configure a DNS entry ... Is the companyweb virtual server running in the default web site? ... response, but I'd rather air on the side of safety then give you the ...
    (microsoft.public.sharepoint.portalserver)