note 103320 added to function.http-parse-cookie
| From: | marcoigarapava at gmail dot com | Date: | Thu, 07 Apr 2011 03:56:49 +0000 |
| Subject: | note 103320 added to function.http-parse-cookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178583@lists.php.net to get a copy of this message | ||
Here's a good way to get cookies from a page and then resubimit the data to that page (or acess
any other page using the cookies gotten).
<?php
//SOME DATA TO POST
$postData = array
(
'user' => $login,
'pass' => $pass
);
//FIRST POST
$post1 = http_post_fields('http://example.com',
$postData);
//GET THE COOKIES STORED TO THE ARRAY $cookie
preg_match('/Set-Cookie: (.*)\b/', $post1, $cookie);
$cookie = (array) http_parse_cookie($cookie[1]);
$cookie = array( 'cookies' => $cookie["cookies"]);
//POST DATA NOW WITH THE COOKIE
$post2 = http_post_fields('http://example.com',
$postData, array(), $cookie);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 189.63.241.198
----
Manual Page -- http://www.php.net/manual/en/function.http-parse-cookie.php
Edit -- https://master.php.net/note/edit/103320
Del: integrated -- https://master.php.net/note/delete/103320/integrated
Del: useless -- https://master.php.net/note/delete/103320/useless
Del: bad code -- https://master.php.net/note/delete/103320/bad+code
Del: spam -- https://master.php.net/note/delete/103320/spam
Del: non-english -- https://master.php.net/note/delete/103320/non-english
Del: in docs -- https://master.php.net/note/delete/103320/in+docs
Del: other reasons-- https://master.php.net/note/delete/103320
Reject -- https://master.php.net/note/reject/103320
Search -- https://master.php.net/manage/user-notes.php