note 36834 deleted from ref.curl by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 19:43:52 +0000 |
| Subject: | note 36834 deleted from ref.curl by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155258@lists.php.net to get a copy of this message | ||
Note Submitter: rodneywa at yahoo dot com
----
Here's how I was able to post arrays using Curl:
$array_of_vars[]="var1";
$array_of_vars[]="var2";
$array_of_vars[]="var3";
$array_of_vars[]="var4";
$submit_url = "http://www.example.com/reads_post.php";
$formvars["feild1"] = "feild1";
for ($i=0;$i<sizeof($array_of_vars);$i++)
$formvars["array_of_vars[$i]"] = $dna[$i];
// init curl handle
$ch = curl_init($submit_url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $formvars);
// perform post
$rr=curl_exec($ch);
echo $rr;
curl_close($ch);