<?php

$SearchIndex =$_POST["SearchIndex"];
$Keywords 	=$_POST["Keywords"];
$ItemPage 	=$_POST["ItemPage"];

ItemSearch($SearchIndex,$Keywords,$ItemPage);

function ItemSearch($SearchIndex, $Keywords, $ItemPage){
//Change this for your amazon key to recieve split of purchase through amazon
	$AssocTag = "wwwadenforsha-20";
	$request="http://ecs.amazonaws.co.uk/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=1CJRSQJ1PBQ98JM71X82&AssociateTag=".AssocTag."&Version=2006-09-11&Operation=ItemSearch&ResponseGroup=Medium,Reviews";
	$request.="&SearchIndex=$SearchIndex&Keywords=$Keywords&ItemPage=$ItemPage";
	$session = curl_init($request);
	curl_setopt($session, CURLOPT_HEADER, false);
	curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
	$response = curl_exec($session);
	curl_close($session); 
	print $response;
	$parsed_xml = simplexml_load_string($response);
	print $parsed_xml;
}
?>