Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-07-2013, 11:54 AM   PM User | #1
nickcraneuk
New Coder

 
Join Date: Jan 2013
Posts: 16
Thanks: 3
Thanked 0 Times in 0 Posts
nickcraneuk is an unknown quantity at this point
Question 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.

http://top40-charts.com/chart.php?cid=40

In addition, if this isn't possible then I am going to try and pull the latest twitter statuses from Trance Network.

https://twitter.com/statuses/user_ti...ce_Network.xml

Any suggestions on how to do it?

Thank you so much in advance for your help.

Nicholas Crane
nickcraneuk is offline   Reply With Quote
Old 02-07-2013, 01:36 PM   PM User | #2
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
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.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk

Last edited by Redcoder; 02-07-2013 at 01:39 PM..
Redcoder is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:14 PM.


Advertisement
Log in to turn off these ads.