13.09.2016 Views

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

844 Chapter 33 Connecting to <strong>Web</strong> Services with XML <strong>and</strong> SOAP<br />

Listing 33.11<br />

Continued<br />

} else {<br />

return false;<br />

}<br />

}<br />

function manufacturer() {<br />

if(isset($this->manufacturer)) {<br />

return $this->manufacturer;<br />

} else {<br />

return false;<br />

}<br />

}<br />

function salesRank() {<br />

if(isset($this->salesRank)) {<br />

return $this->salesRank;<br />

} else {<br />

return false;<br />

}<br />

}<br />

function availability() {<br />

if(isset($this->availability)) {<br />

return $this->availability;<br />

} else {<br />

return false;<br />

}<br />

}<br />

}<br />

Again, this constructor takes two different forms of input data <strong>and</strong> creates one application<br />

interface. Note that while some of the h<strong>and</strong>ling code could be made more generic,<br />

some tricky attributes such as reviews have different names depending on the method.<br />

Having gone through all this processing to retrieve the data, you now return control<br />

back to the getARS() function <strong>and</strong> hence back to showBrowseNode().The next step is<br />

showSummary($ars->products(), $page,<br />

$ars->totalResults(), $mode,<br />

$browseNode);<br />

The showSummary() function simply displays the data in the AmazonResultSet, as you<br />

can see it all the way back in Figure 33.1.We therefore did not include the function<br />

here.

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

Saved successfully!

Ooh no, something went wrong!