Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
02-07-2013, 11:54 AM #1
- Join Date
- Jan 2013
- Thanked 0 Times in 0 Posts
Pulling Content from another website.
Hi there, I would like some help pulling content from another site.
I am trying to pull the top 5 results of this chart via php and then display them on my site to automatically update.
In addition, if this isn't possible then I am going to try and pull the latest twitter statuses from Trance Network.
Any suggestions on how to do it?
Thank you so much in advance for your help.
02-07-2013, 01:36 PM #2
For the Top-40 charts, you just need to make a script that pulls the data (using file_get_contents or cURL - I advise cURL because you can set multiple parameters like spoofing user-agent, multiple url fetch etc), then you scrape the data.
By scraping, I mean you study the HTML structure then parse the DOM using a robust HTML parser like simple html dom, QueryPath, PHPQuery and others you may think of or just use libxml(but I propose a HTML parser because of the shallow learning curve and the CSS3 selectors. But choose wisely, some of them have bad memory leaks...e.g simple html dom depending on the level and looping when parsing).
Dom't use Regular expressions to parse HTML. After that, have the script store the data in the Database. Then to have the data 'automatically update' set the script to run after a certain amount of time using a cronjob. Make sure to space it out well to prevent your server's IP from being blocked.
Last edited by Redcoder; 02-07-2013 at 01:39 PM.