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
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
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., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho