note 63213 added to ref.curl
| From: | php-general at lists dot php dot net | Date: | Thu, 16 Mar 2006 08:30:48 +0000 |
| Subject: | note 63213 added to ref.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-105895@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 64.71.164.2
Probable Submitter: 67.190.27.238
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/ref.curl.php
Edit -- http://master.php.net/note/edit/63213
Del: integrated -- http://master.php.net/note/delete/63213/integrated
Del: useless -- http://master.php.net/note/delete/63213/useless
Del: bad code -- http://master.php.net/note/delete/63213/bad+code
Del: spam -- http://master.php.net/note/delete/63213/spam
Del: non-english -- http://master.php.net/note/delete/63213/non-english
Del: in docs -- http://master.php.net/note/delete/63213/in+docs
Del: other reasons-- http://master.php.net/note/delete/63213
Reject -- http://master.php.net/note/reject/63213
Search -- http://master.php.net/manage/user-notes.php