Bug #7971 Updated: Unable to open web sites using fope()n command

From: Date: Fri, 10 Aug 2001 21:01:51 +0000
Subject: Bug #7971 Updated: Unable to open web sites using fope()n command
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-62879@lists.php.net to get a copy of this message
ID: 7971 Updated by: jeroen Reported By: sksarkar@eos.ncsu.edu Old Status: Analyzed Status: Closed Bug Type: Sockets related Operating System: BSD 4.0 PHP Version: 4.0.3pl1 New Comment: It currently does, since 4.0.5 Previous Comments: ------------------------------------------------------------------------ [2001-04-16 06:22:46] jmoore@php.net the fopen wrappers do not currently handle redirects (unless this has been correct) use http://www.php.net/ and it will work. - James ------------------------------------------------------------------------ [2000-11-25 15:46:41] sksarkar@eos.ncsu.edu **This is the code ** <? // Headlines Grabber by Neil Moomey, www.neilmoomey.com. // You are free to use this code as you wish. // Make sure you get permission from any web sites you grab code from. // You may want to write the headlines to a file on your server to speed things up. // Grab source code from a file or web site if(!($myFile=fopen("http://www.php.net","r"))) { echo "The news interface is down for maintenance."; exit; } while(!feof($myFile)) { // Read each line and add to $myLine $myLine.=fgets($myFile,255); } fclose($myFile); // Extract everything between start and end. You need to include these lines //in the headlines or pick some unique substring in the html to mark the start //and end of the news. $start="<!---START OF HEADLINES--->"; $end="<!---END OF HEADLINES--->"; $start_position=strpos($myLine, $start); $end_position=strpos($myLine, $end)+strlen($end); $length=$end_position-$start_position; $myLine=substr($myLine, $start_position, $length); // Display HTML echo $myLine; ?> **end of code** **error message** Warning: fopen("http://www.php.net","r") - Undefined error: 0 in /var/apache/htdocs/news/parse_site4.php on line 8 The news interface is down for maintenance. **end of error message** ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=7971&edit=1

« previous php.dev (#62879) next »