Hi,
I'm trying to use fopen to open a remote page. I found a page that
doesn't work, and it's because the page requires cookies. Is there a
way in PHP to pass cookies to a remote host?
Here is my source test code:
Code:
<html><head><ti tle>fopen test</title></head>
<body>
<?
$url = "http://www.bestbuy.com/";
$f = fopen($url, 'r');
if($f)
{
$page = "";
while($pre = fread($f,100000 ))
{
$page = $page.$pre;
}
echo "Page:<br>$page <br><br>";
}
else
{
echo "Can't open page<br>";
}
?>
</body>
</html>
If you run the script, you are supposed to get the remote page
displayed back. In this case I get an error message from Best Buy
complaining that I must enable cookies to visit the site. How can I
overcome this with PHP?
Thanks,
Grant
I'm trying to use fopen to open a remote page. I found a page that
doesn't work, and it's because the page requires cookies. Is there a
way in PHP to pass cookies to a remote host?
Here is my source test code:
Code:
<html><head><ti tle>fopen test</title></head>
<body>
<?
$url = "http://www.bestbuy.com/";
$f = fopen($url, 'r');
if($f)
{
$page = "";
while($pre = fread($f,100000 ))
{
$page = $page.$pre;
}
echo "Page:<br>$page <br><br>";
}
else
{
echo "Can't open page<br>";
}
?>
</body>
</html>
If you run the script, you are supposed to get the remote page
displayed back. In this case I get an error message from Best Buy
complaining that I must enable cookies to visit the site. How can I
overcome this with PHP?
Thanks,
Grant
Comment