Forum Moderators: coopster
Array
(
[TotalResults] => 55656
[Details] => Array
(
[0] => Array
(
[Url]=>http://amazon.com/...
[Asin] => 60092572
[ProductName] => The Terminal Man
[Catalog] => Book
[Authors] => Array
(
[0] => Michael Crichton
)
[ReleaseDate] => 05 November, 2002
[Manufacturer] => Avon
and so on...
Here is a very basic example of how you can access the info. It assumes that the array is named "$array", so change all occurrences of $array to the name of the array returned from Amazon.
It uses for loops on the array. Not the nested for() loop for authors because it is an array itself.
$count = count($array['Details']);
for ($i = 0; $i < $count; $i++){
print $array['Details'][$i]['ProductName'] . '<br />';
print '<a href="' . $array['Details'][$i]['Url'] . '">Buy Now!</a>';
$author_count = count($array['Details'][$i]['Authors']);
print 'By: ';
for ($e = 0; $e < $author_count; $e++){
print $array['Details'][$i]['Authors'][$e] . '<br />';
}
}
Birdman
However, I'm still strugling with that. I didn't make myself clear in my first post -I'm sorry about that. I'm trying to use new WSDL 4.0. It has different structure than the old WSDL doc.
Ok, here what I'm using:
include('nusoap.php');
// create client from WSDL
$soapclient =
new soapclient('http://aws-beta.example.com/AWSSchemas/AWSProductData/beta/US.wsdl',
'wsdl');
// We need to switch encoding to UTF-8, since NuSoap
// default is ISO-8859-1.
$proxy->soap_defencoding = "UTF-8";
// Construct request
$request = array ("Keywords" => "XML",
"SearchIndex" => "Books");
// Construct all parameters
$params = array ("SubscriptionId" => "YOUR_ID",
"Request" => $request);
// Submit the ItemSearch request!
$result = $proxy->ItemSearch($params);
// Print request and response
print $proxy->request;
print $proxy->response;
/////////////////////////////////////
and the output is:
///////////////////////////////////////
<Items>
<Request>
<IsValid>True</IsValid>
<ItemSearchRequest>
<Keywords>Java</Keywords>
<SearchIndex>Books</SearchIndex>
</ItemSearchRequest>
</Request>
<TotalResults>2899</TotalResults>
<TotalPages>290</TotalPages>
<Item>
<ASIN>0201310058</ASIN>
<DetailPageURL>
[example.com...]
location=/exec/obidos/ASIN/0201310058/ws
%3FSubscriptionId=12X25ZX3MKB979R00482
%26camp=2025%26link_code=sp1
and so on..
My goal is to have a ability to diplay data how I want to, I mean I'd like to have something like this:
echo $somevar['ImageSmall'];
echo $somevar['Author'];
..etc..
Does anyone can help me?
Thanks.
[edited by: ergophobe at 6:47 pm (utc) on Sep. 28, 2004]
[edit reason] fixed sidescroll; changed url 'amazon' to 'example' [/edit]