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 thi
You'd probably be better off using cURL. Use curl_setopt to set up the cookie handling options.
If this is just a one-off thing, you could use Firefox with Live HTTP Headers to get the header, then paste it into your PHP code.
Shazam - that worked ! Thx soooo much ! In case someone else stumbles upon this page, here's what was needed in detail:
change the prior-listed PHP to the following:
<?php
$cr = curl_init('http://remoteServer/login.php?user=xxx&pass=yyy');
curl_setopt($cr, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cr, CURLOPT_COOKIEJAR, 'cookie.txt');
$whoCares = curl_exec($cr);
curl_close($cr);
$cr = curl_init('http://remoteServer/pageicareabout.html');
curl_setopt($cr, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cr, CURLOPT_COOKIEFILE, 'cookie.txt');
$documentiwant = curl_exec($cr);
curl_close($cr);
?>
Above code snippet heavily influenced by http://www.weberdev.com/get_example-4555.html.