Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
20.9.2014 - We have just updated our course layouts and descriptions and added our 2015 schedule.

Grab information from another Website

Posted by keith (keith), 1 March 2005
Hi all,

Graham,
In our training course, you showed us how to use ('rip') information from another website.

I wan't to get the latest exchange rates and use them to maintain pricing details.

Thanks

Keith

Posted by admin (Graham Ellis), 2 March 2005
Here's the vital line from our exchange rate convertor - this example script visits the web site of the Central European Bank and reads the file of exchange rates that's available there as an XML feed. Very similar to what you want!

Code:
$stuff = file("http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml");


Note of caution for the reader of this page who is looking to "rip off" (as Keith put it) other sites.  Please check that your action is acceptable before you grab content in this way.  Respect the site owner's copyright and robots exclusion requests (as you will be a robot).  Look to store a cached copy of the information you grab and refresh it only from time to time. Just because something is easily possible doesn't mean it's legal.  Look at copying CDs!.  Keith - what you're looking to do is fine, though I would suggest you keep a local copy of the file and only refresh it once a day.  You can have your script check do this automatically.


Posted by admin (Graham Ellis), 2 March 2005
I've written a full demo application - this is something that crops up quite often.

Run the demo

Read about it and see the code

Posted by keith (keith), 4 March 2005
Thanks Graham.
I am only using this script to grab 'useful' and 'legal' content for my site. I will not use it to illegally grab other peoples hard work! (eg; images)

Also thanks for the tip about updating once a day.

Regards

Keith

Posted by admin (Graham Ellis), 6 March 2005
on 03/04/05 at 22:08:35, keith wrote:
Thanks Graham.
I am only using this script to grab 'useful' and 'legal' content for my site.


I totally know this, Keith ... we pick up exchange rates in just exactly this way from the public European Bank site, where they provide a file for this very purpose.

Solutions posted on "Opentalk" are visible to the originator of the question, and to anyone else who happens to come by. Nearly 500 people are registered here now, and many more will find and read the archives occasionally through a search engine such as Google.

So where I talk about a technique through which people could, even unknowingly, make a nuisance of themselves or break one of various laws, I have to add appropriate cautions onto the end of my post.  



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho