(.*?)<\/span>.*?.*?<\/a>:<\/span>.*?<\/span> (.*?)<\/span>'; //amazon search $scrape = scrape_standard($amazon['preg'], $amazon['scrape'].urlencode($search));//send preg & search url will return a array $search = trim(strip_tags($scrape[0][1]));//new search string query result from amazon $searchtitle = $search;//used to output it to the user //save results to variable $prices[0]['price'] = str_replace('£',"",htmlentities($scrape[0][3])); $prices[0]['retailer'] = $amazon['title']; $prices[0]['link'] = $scrape[0][2]; unset($scrape); //extract console name from amazon title $lowercase_search = strtolower($search);//title from the amazon result in lowercase. $target[1] = "xbox"; $target[2] = "wii"; $target[3] = "ps3"; $target[4] = "pc"; for($i=1;$i<=5;$i++){ if(stristr($lowercase_search, $target[$i]) === FALSE) { $result = 0; }else{ $result = $i; break; } } $string1 = $search; $needle = "("; //find length of the needle $needle_len = strlen($needle); //find postion $position_num = strpos($string1,$needle) + $needle_len -1; //cut the string $result_string = substr("$string1",0,$position_num); $search = urlencode(trim($result_string));// the url friendly search used to search the other sites. //play searches $searches['play'][0] = NULL;//not used $searches['play'][1] = "http://www.play.com/Search.aspx?searchtype=X360&searchstring=";//xbox 360 $searches['play'][2] = "http://www.play.com/Search.aspx?searchtype=WII&searchstring=";//wii $searches['play'][3] = "http://www.play.com/Search.aspx?searchtype=PS3&searchstring=";//ps3 $searches['play'][4] = "http://www.play.com/Search.aspx?searchtype=PC&searchstring=";//pc //play scrape data $play['scrape'] = $searches['play'][$result].$search; $play['title'] = "Play.com"; $play['url'] = "http://play.com"; $play['preg'] = '<\/a><\/div><\/td>
(.*?)<\/a>.*?<\/strong><\/span><\/h5>
£(.*?) '; //scrape play $scrape = scrape_standard($play['preg'], $play['scrape']); $prices[1]['price'] = $scrape[0][3]; $prices[1]['retailer'] = $play['title']; $prices[1]['link'] = $play['url'].$scrape[0][1]; unset($scrape);//clears variable //asda searches $searches['asda'][0] = "http://www.asda-entertainment.co.uk/elysium.search?search="; $searches['asda'][1] = "&searchFilters=WGJveCAzNjAjZGVwYXJ0bWVudDpnYW1lc1wvcGxhdGZvcm1zXC94Ym94XC0zNjAh";//xbox 360 $searches['asda'][2] = "&searchFilters=TmludGVuZG8gV2lpI2RlcGFydG1lbnQ6Z2FtZXNcL3BsYXRmb3Jtc1wvbmludGVuZG9cLXdpaSE%3D";//wii $searches['asda'][3] = "&searchFilters=UFMzI2RlcGFydG1lbnQ6Z2FtZXNcL3BsYXRmb3Jtc1wvcHMzIQ%3D%3D";//ps3 $searches['asda'][4] = "&searchFilters=UEMjZGVwYXJ0bWVudDpnYW1lc1wvcGxhdGZvcm1zXC9wYyE%3D";//pc //asda scrape data $asda['scrape'] = $searches['asda'][0].$search.$searches['asda'][$result]; $asda['title'] = "Asda"; $asda['url'] = "http://www.asda-entertainment.co.uk/"; $asda['preg'] = '

.*?.*?<\/a>.*?<\/p>.*?

.*?.*?<\/span>.*?163;(.*?)Free Delivery<\/span>.*?<\/p>'; //scrape asda $scrape = scrape_standard($asda['preg'], $asda['scrape']); $prices[2]['price'] = $scrape[0][3]; $prices[2]['retailer'] = $asda['title']; $prices[2]['link'] = $asda['url'].$scrape[0][1]; unset($scrape);//clears variable //zavvi searches $searches['zavvi'][1] = "http://www.zavvi.com/elysium.search?searchFilters=WGJveCAzNjAjZGVwYXJ0bWVudDpnYW1lc1wvcGxhdGZvcm1zXC94Ym94XC0zNjAh&search=";//xbox 360 $searches['zavvi'][2] = "http://www.zavvi.com/elysium.search?searchFilters=TmludGVuZG8gV2lpI2RlcGFydG1lbnQ6Z2FtZXNcL3BsYXRmb3Jtc1wvbmludGVuZG9cLXdpaSE%3D&search=";//wii $searches['zavvi'][3] = "http://www.zavvi.com/elysium.search?searchFilters=UFMzI2RlcGFydG1lbnQ6Z2FtZXNcL3BsYXRmb3Jtc1wvcHMzIQ%3D%3D&search=";//ps3 $searches['zavvi'][4] = "http://www.zavvi.com/elysium.search?searchFilters=UEMjZGVwYXJ0bWVudDpnYW1lc1wvcGxhdGZvcm1zXC9wYyE%3D&search=";//pc //zavvi scrape data $zavvi['scrape'] = $searches['zavvi'][$result].$search; $zavvi['title'] = "Zavvi"; $zavvi['url'] = "http://www.zavvi.com/"; $zavvi['preg'] = '

.*?.*?<\/a>.*?<\/p>.*?

.*?.*?<\/span>.*?163;(.*?)Free Delivery<\/span>.*?<\/p>'; //scrape zavvi $scrape = scrape_standard($zavvi['preg'], $zavvi['scrape']); $prices[3]['price'] = $scrape[0][3]; $prices[3]['retailer'] = $zavvi['title']; $prices[3]['link'] = $zavvi['url'].$scrape[0][1]; unset($scrape);//clears variable //tesco $searches['tesco'][0] = "http://www.tescoentertainment.com/store/Search.tla/Search?keyword="; $searches['tesco'][1] = "&navigationstate=%3A8126%3A||0";//xbox 360 $searches['tesco'][2] = "&navigationstate=%3A8128%3A||0";//wii $searches['tesco'][3] = "&navigationstate=%3A8124%3A||0";//ps3 $searches['tesco'][4] = "&navigationstate=%3A8130%3A||0";//pc //tesco scrape data $tesco['scrape'] = $searches['tesco'][0].$search.$searches['tesco'][$result]; $tesco['title'] = "Tesco"; $tesco['url'] = "http://www.tescoentertainment.com"; $tesco['preg'] = '.*?

.*?.*?£<\/span>(.*?)<\/p>'; //scrape tesco $scrape = scrape_standard($tesco['preg'], $tesco['scrape']); $prices[4]['price'] = $scrape[0][2]; $prices[4]['retailer'] = $tesco['title']; $prices[4]['link'] = $tesco['url'].$scrape[0][1]; unset($scrape);//clears variable //output some info to users screen echo '

You searched for "'.$searchtitle.'", is this correct ? if not search again

'."\n"; //debug table echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo '
UserSearchIP
'.$uid.''.$search.''.$ip.'
'."\n"; //end of debug table //standard table echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; foreach($prices as $price){ echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; } echo '
SitePriceUrl
'.$price['retailer'].''.$price['price'].''.$price['link'].'
'."\n"; echo ''."\n"; echo ''."\n"; }else{ die('Unknown Error 3'); } }else{ die('Unknown Error 2'); } }else{ die('Unknown Error 1'); } ?>