Page 1 of 1
Parsing News From Php.net
Posted: Mon May 20, 2002 12:47 pm
by fatal
I want to make a custom start page for my computer which would display Php News, amongst them i want the news from Php.net. But i have no idea on how to start this. Is there any functions i should look at? Im thinking of using Regular Expression, is there anything else?
Thanks
Posted: Mon May 20, 2002 6:25 pm
by Anthron
if i'm correct, you'll need to use fopen() and fread() to open up php.net and read the news off their website.
also, when you use fread(), you'll need a number for the number of bytes to read. just make that number 99999999.
so that'll give you the webpage in a variable. From that you'll need to cut out all the excess html. I would try adding all of the excess header html to a file like excess_header.htm and the same to footer (excess_footer.htm). Then open up those files and add them to a variable. Then you can do a regular expression and end up with just the news html.
after that, a few loops and more regular expressions you should have your news.
Of course, I'm not sure if you already knew most of that.
Posted: Tue May 21, 2002 3:36 am
by MattF
Or you could look to see if they have an XML thingy of their news and if they don't you could suggest one.......
Posted: Tue May 21, 2002 7:25 am
by enygma
I don't think the PHP.net site has an XML feed.....it'd be nice if they did, though.
Otherwise, you're just going to have to either fopen or file it (depending on which you want more - a string or an array). Then, use regexps or something to pick out the headlines.
You better hope they keep it pretty standardized.....
Posted: Tue May 21, 2002 11:13 am
by fatal
I can only hope
