note 63213 deleted from ref.curl by betz
| From: | betz@php.net | Date: | Thu, 16 Mar 2006 10:21:03 +0000 |
| Subject: | note 63213 deleted from ref.curl by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-105902@lists.php.net to get a copy of this message | ||
Note Submitter:
----
A limitation I noticed - curl doesn't seem to want to post multi-dimension arrays:
With this array:
Array ( [email] => user@domain [emailconfirm] => user@domain [htmlemail] => 1 [attribute9]
=> 3 [attribute1] => William [list] => Array ( [1] => signup ) [listname] => Array (
[1] => News, Gibberish, and More ) [subscribe] => Subscribe to the Selected Newsletters )
And this code:
$suffix = '?p=subscribe&id=1';
$url='http://www.blah/?'.$suffix;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_vars);
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_VERBOSE, 1);
//curl_setopt($ch, CURLOPT_HEADER, 1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
$out = curl_exec ($ch);
if (curl_errno($ch)) {
print 'Error: '.curl_error($ch);
}
curl_close ($ch);
The script runs without returning an error but the server doesn't recognize the form data as
being complete, even though based on the array content (seen via print_r) it is complete.