Prev | Current Page 775 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

com Apparel department for the
postal t-shirt keywords. One trivial way is to use the PHP file_get_contents() function, as you
can see in the following script.
To test accessing web services using REST, create a new file named test_rest.php in your
tshirtshop directory, and write the following code in it:
// Tell the browser it is going to receive an XML document.
header('Content-type: text/xml');
/* DON'T FORGET to replace the string '[Your Access Key ID]' with your
Access Key ID in the following line */
$url = 'http://webservices.amazon.com/onca/xml?Service=AWSECommerceService' .
'&AWSAccessKeyId=[Your Access Key ID]' .
'&Operation=ItemSearch' .
'&Keywords=postal+t-shirt' .
'&SearchIndex=Apparel' .
'&ResponseGroup=Request,Medium,VariationSummary';
echo file_get_contents($url);
?>
CHAPTER 22 ?–  USING AMAZON.COM WEB SERVICES 672
?– Note Some PHP installations and web hosting providers might not allow this code to run by default. In
that case, you can change this setting in php.ini:
allow_url_fopen = On
Alternatively, you can add the following line to include/config.php. This second solution is preferred
because it affects only your application, and it remains set if you need to move the application to another
server.
ini_set('allow_url_fopen', 'On');
Loading http://localhost/tshirtshop/test_rest.php will show you XML data about
Amazon.


Pages:
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787
Wczasy nad morzem szafy buchsbaum hotele londyn zakłady bukmacherskie