0

I am trying to get data from a site and be able to manipulate it to display it on my own site.
The site contains a table with ticks and is updated every few hours.
Here's an example: http://www.astynomia.gr/traffic-athens.php

This data is there for everyone to use, and I will mention them on my own site just to be sure.

I've read something about php's cURL but I have no idea if this is the way to go.
Any pointers/tutorials, or code anyone could provide so I can start somewhere would be very helpful. Also any pointers on how I can get informed as soon as the site is updated?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
krasatos
  • 1,177
  • 3
  • 13
  • 26

2 Answers2

1

If you want to crawl the page, use something like Simple HTML DOM Parser for PHP. That'll server your purpose.

Bibhas Debnath
  • 14,559
  • 17
  • 68
  • 96
1

First, your web host/localhost should have the php_curl extension enabled.

To start with, you should read a bit here. If you want to jump in directly, there is a simple function here Why I can't get website content using CURL. You just have to change the value of the variables $url,$timeout

Lastly, to get the updated data every 2hrs you will have to run the script as a cronjob. Please refer to this post PHP - good cronjob/crontab/cron tutorial or book

Community
  • 1
  • 1
Bob
  • 1,489
  • 1
  • 16
  • 28
  • to enable the curl i go wamp/php/phpextentions and tick the curl right? thats all? also, what would be preferable? @bibhas crawling solution or cUrl? – krasatos Apr 20 '12 at 11:27
  • to enable the curl i go wamp/php/phpextentions and tick the curl right? - yes, don't forget to restart your server. – Bob Apr 20 '12 at 12:32
  • Try to use Simple HTML DOM Parser first for your requirements. http://developer.practicalecommerce.com/articles/3123-Scrape-Site-Content-with-Simple-HTML-DOM-Parser-in-PHP – Bob Apr 20 '12 at 13:04