nitch Posted June 6, 2007 Share Posted June 6, 2007 Hey, I'm having some trouble figuring out how to use php to open a file on another website to get the contents. for example $filestuff = fopen("http://www.tutorialpod.com/index.php","r") or die("could not open"); $contents = fread($filestuff, filesize("http://www.tutorialpod.com/index.php")) or die("could not read"); fclose($filestuff); echo $contents; this code is executing from another website and dies on the fopen statement. What I want is to just get the contents of that page, after the php code is executed on the server and displayed in a browser. Any help is greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/54485-opening-a-url/ Share on other sites More sharing options...
per1os Posted June 6, 2007 Share Posted June 6, 2007 Use phpinfo(); and search for "allow_url_fopen" if that is not enabled you cannot use fopen to retrieve the file. Try www.php.net/file_get_contents or www.php.net/file But chances are if the allow_url_fopen is not enabled/on you cannot do it. Link to comment https://forums.phpfreaks.com/topic/54485-opening-a-url/#findComment-269491 Share on other sites More sharing options...
dbillings Posted June 7, 2007 Share Posted June 7, 2007 What specifically are you trying to retrieve from that page? You might be able to do a page scrape to retrieve the data. Link to comment https://forums.phpfreaks.com/topic/54485-opening-a-url/#findComment-269640 Share on other sites More sharing options...
Yesideez Posted June 7, 2007 Share Posted June 7, 2007 nitch, are you trying to do something like this? http://www.pictureinthesky.net/utils/ripper.php Link to comment https://forums.phpfreaks.com/topic/54485-opening-a-url/#findComment-269653 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.