13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Solution Overview<br />

831<br />

Listing 33.8<br />

Continued<br />

'AssociateTag' => ASSOCIATEID, 'Request'=>array($request));<br />

// perform actual soap query<br />

$result = $soap_proxy->ItemSearch($parameters);<br />

if(isSOAPError($result)) {<br />

return false;<br />

}<br />

$this->totalResults = $result['TotalResults'];<br />

foreach($result['Items']['Item'] as $product) {<br />

$this->products[] = new Product($product);<br />

}<br />

unset($soapclient);<br />

unset($soap_proxy);<br />

} else {<br />

// form URL <strong>and</strong> call parseXML to download <strong>and</strong> parse it<br />

$this->url = "http://ecs.amazonaws.com/onca/xml?".<br />

"Service=".$this->Service.<br />

"&Operation=".$this->Operation.<br />

"&AssociateTag=".$this->AssociateTag.<br />

"&AWSAccessKeyId=".$this->AWSAccessKeyId.<br />

"&BrowseNode=".$this->BrowseNode.<br />

"&ResponseGroup=".$this->ResponseGroup.<br />

"&SearchIndex=".$this->SearchIndex.<br />

"&Sort=".$this->Sort.<br />

"&TotalPages=".$this->TotalPages;<br />

}<br />

$this->parseXML();<br />

}<br />

return $this->products;<br />

// Given an ASIN, get the URL of the large image<br />

// Returns a string<br />

function getImageUrlLarge($ASIN, $mode) {<br />

foreach($this->products as $product) {<br />

if( $product->ASIN()== $ASIN) {

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!