Read webpage source from fopen
Posted: Tue Dec 16, 2008 8:41 am
Hello
when read the site content of http://www.google.com by using fopen it works fine
<?php
$fh = fopen("http://www.google.com/", "r");
while(!feof($fh))
{
$output = htmlspecialchars(fgets($fh, 1024));
echo ("$output<br />");
}
fclose($fh);
?>
But
when read the site content of http://www.youtube.com, it fails; gives error
why is that!
How to read the youtube.com source by using fopen (Or any other method)
<?php
$fh = fopen("http://www.youtube.com/", "r");
while(!feof($fh))
{
$output = htmlspecialchars(fgets($fh, 1024));
echo ("$output<br />");
}
fclose($fh);
?>
Thanks
Need help!
when read the site content of http://www.google.com by using fopen it works fine
<?php
$fh = fopen("http://www.google.com/", "r");
while(!feof($fh))
{
$output = htmlspecialchars(fgets($fh, 1024));
echo ("$output<br />");
}
fclose($fh);
?>
But
when read the site content of http://www.youtube.com, it fails; gives error
why is that!
How to read the youtube.com source by using fopen (Or any other method)
<?php
$fh = fopen("http://www.youtube.com/", "r");
while(!feof($fh))
{
$output = htmlspecialchars(fgets($fh, 1024));
echo ("$output<br />");
}
fclose($fh);
?>
Thanks
Need help!