Main Content

PHP data sources - other web servers, large data flows, and the client (browser)

Archive - Originally posted on "The Horse's Mouth" - 2010-11-04 06:55:14 - Graham Ellis

As always, I've written a sprinkling of new demonstrations amongst some well-trodden example during the PHP course I'm presenting this week:

There's a really short example of how you can call up another server from your own server - [here]. So much more can be made of the web by presenting and combining resources from many different sources - rather than just data off you own machine. We do it "for real" by collecting the current weather from the BBC to include in our travel to Melksham page, and by collecting data about train running from railway sources for the graphic in the top left corner of our First Great Western Passenger Forum.

I've extracted data from the large flows I'm generating from the server work I was doing last week - a good example of some of the low level PHP string handling functions [here] (and you can see the incoming data to that [here].

Finally, there are a few golden nuggets that you can get from the user's request that will help you tailor the page you send back to him - things like finding out where he's visiting your site from, and what language he prefers to read the response in. The sample program is [here].


Run the page with user's browser information [here]
Run the page that looks at another server [here]
Run the page that extracts from a log fil [here]