Somebody gave me the script below to scrape Google.co.uk movie theater listings onto my site. I have saved the file as cinemas.php here and then accessing it from a HTML file, but it just says http://www.google.co.uk/movies?hl=en&near=&sort=1&q= I needed some help from the PHP gurus, as I'm not really an expert with the language: what do I do now? How do I use the script? Also, can I ask if it is likely the script will break from time to time? I realise it's a guess, because nobody knows how frequently Google will change their movie listings, but anybody? I installed another PHP script and am having to constantly change it every two weeks because the site it is pulling data from keeps changing their format. <?php $URL="<A href="http://www.google.co.uk/movies?hl=en&near=".urlencode($town)."&sort=1&q=".urlencode($moviename">http://www.google.co.uk/movies?hl=en&near=".urlencode($town)."&sort=1&q=".urlencode($moviename); echo $URL; // Where to Start grabbing and where to End grabbing $Start = "Film Showtimes"; //$Start = "<a href=\"/movies?hl=en&near="; $End = "Language Tools"; // Open the file //$file = fopen("$URL", "r"); // Read the file $r = file_get_contents ($URL); // Grab just the contents we want $stuff = eregi("$Start(.*)$End", $r, $content); //echo $stuff; // Get rid of some rubbish we don't need. $allowedtags = "<b><br>"; $content[1]= strip_tags ($content[1],$allowedtags); $content[1]= str_replace("<b>", "<p><b>", $content[1]); $content[1]= str_replace("IMDb", "", $content[1]); $content[1]= str_replace("Map", "", $content[1]); $content[1]= str_replace("<b>Today</b>", "<!--", $content[1]); $content[1]= str_replace(" reviews<p>", "-->", $content[1]); $content[1]= str_replace(" - Film rating - Film title", "", $content[1]); echo $content[1]; ?> Code (markup): Thank you very much.
Sorry, I didn't know it was illegal! I just wanted to try integrating the movie theater listings into my website. I wanted to know what exactly to do to use the PHP script.
Firstly you should use an include to pull the script into a php file. Also you need to set the moviename variable before the script is run.