This article will give you a brief explanation about how to get the content from others web sites. Before we go on, I must to remind you that the content that you will retrieve is opened for the public. However I won't make any responsibility of any claim from the owner of the sites.
Sometimes we want give the public information to the user of our sites, oneway to do that was make sure your eyes keep opened from the 'public sites' and you must work quickly to update your site with the 'updated information'. Preety hard here to give you an example what is the 'public sites' I talking about. Let's said for example : Newspaper Headline, Market Stock, Cinema's Schedule or even our favorite sites --> www.php.net
So.. for our example I will give you how to get the content from php.net to inform our user about the latest version of PHP. I'm sure the php.net will give us permission to make the example, since I'm not doing any commercial things here .. =)
The explanation :
1. Specified the url (or the page) that we will gonna retrieve
2. Store the whole code into array called $lines_array
3. We parse the content from $lines_array into $lines_string
4. We 'cut' the whole code with an eregi function.. in this case we want to take the information which is start from the <!--http://www.php.net/--> until ended with <!-- end body -->. How do I know this ?? Check the HTML source from php.net =)
5. Split them into new array.. in this case we split them with a newline character
6. and 7. We loop the whole array and write it into our HTML source.
That's all folks.. maybe the example is to simple, but not bad for an amateur like me.. =). Make any modification from the code, and u will have a fresh HTML page daily-updated... ;)