* @version $Id: lookup_barcode.php,v 1.4 2007/09/08 09:17:16 andig2 Exp $ */ chdir('..'); require_once('./core/functions.php'); $notFound = 0; if (isset($_GET['barcode'])) { // Base URL for the search $url = 'http://s1.amazon.co.uk/exec/varzea/sdp/sai-condition/'; // Add our post options and get the data $post = 'sdp-sai-asin='.$_GET['barcode']; $amazon_data = httpClient ($url, 0, $post); // If it succeeds.... if ($amazon_data['success'] == 1) { if (preg_match("/(.*)<\/b>/", $amazon_data['data'], $matches)) { if ($matches[1] == 'Identify the exact item you&//039;re selling') { $notFound = 1; } else { $media_type = 1; $title = urlencode($matches[1]); if (preg_match("/http:\/\/www.amazon.co.uk\/exec\/obidos\/ASIN\/(.*)\//", $amazon_data, $matches)) { $asin_number = "ASIN: $matches[1]"; } else { $asin_number = 'ASIN not found'; } if (preg_match("/alt=\"VHS\"/", $amazon_data['data'], $matches)) { $media_type = 6; } header("Location: ../edit.php?save=1&lookup=1&title=$title&diskid={$_GET['barcode']}&mediatype=$media_type&subtitle=$asin_number"); } } else { $notFound = 2; } } else { // Print the error message print "Failed to download:
\n"; print $amazon_data['error']; } } ?> Add movie by Amazon-UK barcode

Add movie by Amazon-UK barcode

\n"; //print_r($amazon_data); } elseif ($notFound == 2) { print "No data returned!
\n"; print_r($amazon_data); } ?>