note 80683 added to function.http-post-fields
| From: | wormholio at gmail dot com | Date: | Tue, 29 Jan 2008 03:32:05 +0000 |
| Subject: | note 80683 added to function.http-post-fields | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135497@lists.php.net to get a copy of this message | ||
To use POST to submit a form to a site which requires a cookie for authentication you put the cookie
in the $options array. Example:
<?php
$auth="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$form_url="http://pirates.spy-hill.net/forum_reply.php?thread=663";
$message = "RoboCodeDwarf now has the gold. \n\n";
$message .= "RoboCodeDwarf sez: [quote] " .
fortune -s .
"[/quote]\n";
$form_fields = array(
'content' => $message,
'add_signature' => 'add_it',
'submit' => 'Post reply' );
$form_files=array();
$form_options=array( 'cookies' => array( 'auth' => $auth ) );
$response = http_post_fields($form_url, $form_fields, $form_files, $form_options );
$n = preg_match("/HTTP\/1.1 302 Found/", $response, $matches);
if($n<1) echo "FAILED\n";
else echo "POSTED\n";
?>
----
Server IP: 69.147.83.197
Probable Submitter: 76.15.106.184
----
Manual Page -- http://www.php.net/manual/en/function.http-post-fields.php
Edit -- https://master.php.net/note/edit/80683
Del: integrated -- https://master.php.net/note/delete/80683/integrated
Del: useless -- https://master.php.net/note/delete/80683/useless
Del: bad code -- https://master.php.net/note/delete/80683/bad+code
Del: spam -- https://master.php.net/note/delete/80683/spam
Del: non-english -- https://master.php.net/note/delete/80683/non-english
Del: in docs -- https://master.php.net/note/delete/80683/in+docs
Del: other reasons-- https://master.php.net/note/delete/80683
Reject -- https://master.php.net/note/reject/80683
Search -- https://master.php.net/manage/user-notes.php