Reputation: 29
Which way could I grab cinema listings and times etc from a cinema website for a client? They will have permission to do this from the cinema as the cinema is in their premises.
I have a CMS set up for their website however, it would be a nightmare to update this everyday.
Upvotes: 1
Views: 307
Reputation: 13394
It's very difficult to grab an parse an rendered website. You could use php-curl to load the page into the php runtime. Look at this:
http://www.php.net/manual/en/book.curl.php
http://nadeausoftware.com/articles/2007/06/php_tip_how_get_web_page_using_curl
It's also possible to load the page with wget and parse them with php.
At the 2dn step you have to parse that loaded webpage. Thats also very tricky.
--> all together that's not a good idea to grab directly from the website.
You need an data exchange format. That means, the client needs an XML Document with the related cinama-listings and times. You can parse that XML with php-XML Parser:
http://www.php.net/manual/en/book.xml.php
An other way is an background database - to fetch the wanted information from the DB.
Upvotes: 0
Reputation: 19872
Given that the cinema has a web service or you have database access to the cinema listings, there will be no problem. Either you invoke the web service OR you directly access the database to retrieve cinema listings.
Or else your nightmarish choice is screen scraping which is thoroughly discouraged.
Because if the site structure of the cinema changes at least a lil bit, there is a very high chance that you will have to write your code again.
Find out whether the cinema provides a service where you can connect and retrieve the information you need.
Upvotes: 2