Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
PHP and MySQL Web Development - P159: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 762 Chapter 31 Connecting to Web Services with XML and SOAP Listing 31.8 Continued var _browseNode var _ASIN var _page var _mode var _url var _type var _totalResults var _currentProduct null var _products array array of Product objects var _names array array of names of the XML nodes we have entered. treated as a stack. Only used during parsing. function products return this- _products function totalResults return this- _totalResults function getProduct i if isset this- _products i return this- _products i else return false Perform a query to get a page full of products from a browse node Switch between XML HTTP and SOAP in constants.php Returns an array of Products function browseNodeSearch browseNode page mode if METHOD SOAP the NuSOAP class generates a lot of notices. Turn them off. error_reporting error_reporting E_NOTICE soapclient new soapclient http soap.amazon.com schemas2 AmazonWebServices.wsdl wsdl soap_proxy soapclient- getProxy parameters mode mode Solution Overview 763 Listing 31.8 Continued parameters page page parameters type heavy parameters tag this- _assocID parameters devtag this- _devTag parameters sort salesrank parameters browse_node browseNode perform actual soap query result soap_proxy- BrowseNodeSearchRequest parameters if isSOAPError result return false this- _totalResults result TotalResults counter 0 foreach result Details as product this- _products counter new Product this- _products counter - soap result Details counter counter unset soapclient unset soap_proxy else form URL and call parseXML to download and parse it this- _type browse this- _browseNode browseNode this- _page page this- _mode mode this- _url http xml.amazon.com onca xml2 t .ASSOCIATEID . dev-t .DEVTAG. BrowseNodeSearch . this- _browseNode. mode . this- _mode . type heavy page . this- _page. sort salesrank f xml this- parseXML return this- _products Given an ASIN get the URL of the large image Returns a string function getImageUrlLarge ASIN mode if this- _products 0 - .