note 36834 added to ref.curl
| From: | rodneywa at yahoo dot com | Date: | Fri, 24 Oct 2003 05:47:47 +0000 |
| Subject: | note 36834 added to ref.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59201@lists.php.net to get a copy of this message | ||
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);
----
Manual Page -- http://www.php.net/manual/en/ref.curl.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36834
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36834&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36834&report=yes
Search -- http://master.php.net/manage/user-notes.php