RE: [PHP] Re: Using fopen()/fread()/fscanf()

From: Date: Tue, 23 Jul 2002 06:41:43 +0000
Subject: RE: [PHP] Re: Using fopen()/fread()/fscanf()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-109049@lists.php.net to get a copy of this message
Okay, I removed that line and I no longer get the invalid File-Handle resource error, but I also don't get anything useful. Maybe my fscanf() line needs some work? With this new code, if I print_r($headlines); I get 229 of these: Array ( [0] => ) Code: $filename = fopen("http://www.kinyradio.com/juneaunews/latest_juneau_news.html", "r"); while($headlines = fscanf($filename, "<p style=\"padding-left: 45\"><font face=\"Verdana\" size=\"3\"><b>%[a-zA-Z0-9,. ]</b></font>")) { print_r($headlines); } fclose($filename); What the fscanf() code -should- be doing, or at least what I intend for it to do, is grab everything between <p style="padding-left: 45...><b> and </b></font> - is my code structured for that? -----Original Message----- From: Martin Towell [mailto:martin.towell@world.net] Sent: Monday, July 22, 2002 10:16 PM To: 'Jason Soza'; David Robley; php-general@lists.php.net Subject: RE: [PHP] Re: Using fopen()/fread()/fscanf() I'm thinking that you need to remove the: $contents = fread($filename, 1000000); line. This is probably making the file pointer point to the end of the file. -----Original Message----- From: Jason Soza [mailto:solja@gci.net] Sent: Tuesday, July 23, 2002 4:17 PM To: David Robley; php-general@lists.php.net Subject: RE: [PHP] Re: Using fopen()/fread()/fscanf() I'm fairly certain that fopen() is working fine - I can echo "$contents"; and it works great, but it displays the entire page that I fetched. I just want certain parts of the page and unfortunately, fscanf() doesn't seem to think $contents or $filename are valid. Just more info on this, I tried replacing fscanf($filename,...) with fscanf($contents,...) and got the same result. Thanks, Jason Soza

« previous php.general (#109049) next »