note 66678 deleted from function.curl-setopt by bjori

From: Date: Thu, 25 May 2006 23:34:33 +0000
Subject: note 66678 deleted from function.curl-setopt by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-112296@lists.php.net to get a copy of this message
Note Submitter: zmv2102 at columbia dot edu ---- Passing a <select multiple> through CURLOPT_POSTFIELDS is pretty unintuitive. Try this: <? curl_setopt(CURLOPT_POSTFIELDS, "a=value1&a=value2&a=value3"); ?> That works great, until you need to do something like pass a file through POST, too. After combing the Web for hours, I found that this works: <? curl_setopt(CURLOPT_POSTFIELDS, array( "a[0]" => "value1", "a[1]" => "value2", "a[2]" => "value3", ... "myfile" => "@file.txt" )); ?> This worked as long as I was passing to other PHP scripts. Perl and other languages don't like the parameter[] trick, and while passing to one, I had to use a combination of GET and POST. Caveat emptor.

« previous php.notes (#112296) next »