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
Parsing News From Php.net
Moderator: General Moderators
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.
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.
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.....
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.....