Hiya - I've got a PHP application which needs to grab the contents from another web page, and the web page I'm reading needs a cookie.
I've found info on how to make this call once i have the cookie ( http://groups.google.com/group/comp.lang.php/msg/4f618114ab15ae2a ), however I've no idea how to generate the cookie, or how / where the cookie is saved.
For example, to read this web page via wget I do the following:
wget --quiet --save-cookies cookie.file --output-document=who.cares \
http://remoteServer/login.php?user=xxx&pass=yyy
wget --quiet --load-cookies cookie.file --output-document=documentiwant.html \
http://remoteServer/pageicareabout.html
... my question is how do I do the '--save-cookies' bit in PHP so that I can use the cookie in the follow-up PHP stream_context_create / file_get_contents block:
$opts = array(http'=> array(
'method'=> "GET",
'header'=>
"Accept-language: en\r\n" .
"Cookie: **NoClueAtAll**\r\n"
)
);
$context = stream_context_create($opts);
$documentiwant = file_get_contents("http://remoteServer/pageicareabout.html",
0, $context);