Alright, I see that this is probably the way to go, but I'm dying here. I
have this:
$filename =
fopen("http://www.kinyradio.com/juneaunews/latest_juneau_news.html", "r");
$contents = fread($filename, 1000000);
preg_match_all("|<font face=\"Verdana\" size=\"3\"><b>+[-a-zA-Z0-9,. ]+|i",
$contents, $out);
print_r($out);
And it returns this:
Array ( [0] => Array ( [0] => Injured hiker [1] => Toy guns looked real
enough [2] => U-S Forest Service Chief visiting [3] => Millions in
compensation divided up [4] => Alaska Air [5] => One car [6] => Services [7]
=> Talkeetna ) [1] => Array ( [0] => Injured hiker [1] => Toy guns looked
real enough [2] => U-S Forest Service Chief visiting [3] => Millions in
compensation divided up [4] => Alaska Air [5] => One car [6] => Services [7]
=> Talkeetna ) )
This is definitely progress, but the headlines are truncated. I have a
feeling this has something to do with linebreaks, but I don't know how to
account for those. For example, $out[0][0] should read "Injured hiker
rescued on Mt. Juneau" and $out[0][2] should end with "...Alaska for the
first time".
The manual entries for preg_match and preg_match_all pretty much assume you
have a working knowledge of reg expressions, which I don't, and a google
search turned up a bunch of pages, none of which I could understand enough
to be of help. So, any pointers would be appreciated. Thanks!
Jason Soza
-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 22, 2002 11:01 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Using fopen()/fread()/fscanf()
On Tuesday 23 July 2002 14:16, Jason Soza wrote:
> 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.
Not sure why you're using fscanf() and why it doesn't work. I would use
preg_match() on $contents.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Communications satellite used by the military for star wars.
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php