krasatos
krasatos

Reputation: 1177

Fetch data from other site (php & GET)

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?

Upvotes: 0

Views: 2636

Answers (2)

Bob
Bob

Reputation: 1497

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

Upvotes: 1

Bibhas Debnath
Bibhas Debnath

Reputation: 14929

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

Upvotes: 1

Related Questions