Mercurial > hg > ywww
annotate xml/getAmazonInfo.php @ 19:84a412b8122c
try to protect against a range of missing info
| author | Charlie Root |
|---|---|
| date | Thu, 30 Aug 2018 17:18:12 -0400 |
| parents | c41a5802b26c |
| children | 46382face560 |
| rev | line source |
|---|---|
| 4 | 1 <?php |
| 2 | |
| 5 | 3 $lastReqTime=0; |
| 4 | 4 function getAmazonDet($isbn,$go,$localeIn) |
| 5 { | |
| 6 global $output; | |
| 7 $Adefault=array( | |
| 8 'language' =>'en', //what language to render the page in | |
| 9 'locale' =>$localeIn, //which server's products? available: ca,de,fr,jp,uk,us | |
| 10 //'mode' =>'books', //what product category? | |
| 11 'page' =>1, //first page to show (we are counting from 1 not 0) | |
| 12 //'search' =>'Machiavelli', //what to search for? | |
| 13 'operation' =>'ItemLookup', //what to do? //ItemSearch | |
| 14 // 'searchindex' =>'Books', //what product category for search? | |
| 15 'searchparameter' =>'ItemId', //what kind of search? | |
| 16 'searchparameterdata'=>$isbn, //what to search for? | |
| 17 //here some debugging flags you can put at the end of the URL to call this script with, like: '?show_array=true' | |
| 18 'show_array' =>false, //debug: show complete incoming array? You can use this to see what other information Amazon is sending | |
| 19 'show_url' =>false, //debug: show XML request url to be send to Amazon? | |
| 20 'show_xml' =>false, //debug: show incoming XML code from Amazon? | |
| 21 ); | |
| 22 //change the debug options to true if you want to activate them or call the script with '?show_array=true' to see what actual information you're getting from Amazon and how little my standard script is actually showing of it | |
| 23 | |
| 24 $Aassociates_id=array( | |
| 25 'uk' => 'bookwhack-21', | |
| 26 'us' => 'your02b-20', | |
| 27 'ca' => 'book009-20', | |
| 28 'de' => 'book04c-21', | |
| 29 'fr' => 'book07f-21', | |
| 30 ); | |
| 31 | |
| 32 $Aserver=array( | |
| 33 'ca' => array( | |
| 34 'ext' => 'ca' , //Canadian normal server | |
| 35 'nor' => 'http://www.amazon.ca' , //Canadian normal server | |
| 36 'xml' => 'http://xml.amazon.com' , //Canadian xml server | |
| 37 ), | |
| 38 'de' => array( | |
| 39 'ext' => 'de' , //German normal server | |
| 40 'nor' => 'http://www.amazon.de' , //German normal server | |
| 41 'xml' => 'http://xml-eu.amazon.com', //German xml server | |
| 42 ), | |
| 43 'fr' => array( | |
| 44 'ext' => 'fr' , //French normal server | |
| 45 'nor' => 'http://www.amazon.fr' , //French normal server | |
| 46 'xml' => 'http://xml-eu.amazon.com', //French xml server | |
| 47 ), | |
| 48 'jp' => array( | |
| 49 'ext' => 'jp' , //Japanese normal server, not co.jp! | |
| 50 'nor' => 'http://www.amazon.co.jp' , //Japanese normal server | |
| 51 'xml' => 'http://xml.amazon.com' , //Japanese xml server | |
| 52 ), | |
| 53 'uk' => array( | |
| 54 'ext' => 'co.uk' , //UK normal server | |
| 55 'nor' => 'http://www.amazon.co.uk' , //UK normal server | |
| 56 'xml' => 'http://xml-eu.amazon.com', //UK xml server | |
| 57 ), | |
| 58 'us' => array( | |
| 59 'ext' => 'com' , //USA normal server | |
| 60 'nor' => 'http://www.amazon.com' , //USA normal server | |
| 61 'xml' => 'http://xml.amazon.com' , //USA xml server | |
| 62 ), | |
| 63 ); | |
| 64 | |
| 65 //if(go != 1) | |
| 66 //include "aws_signed_request.php"; | |
|
17
ae1459564f66
Replace old associate keys with new IAMs user keys
Robert Boland <robert@markup.co.uk>
parents:
11
diff
changeset
|
67 $public_key ="AKIAIHTNWC7L6LOUY4LQ"; |
|
ae1459564f66
Replace old associate keys with new IAMs user keys
Robert Boland <robert@markup.co.uk>
parents:
11
diff
changeset
|
68 $private_key="zWQlIzndJDtXNfxEXH7K7YR7hzv3u77lOcqfqPde"; |
| 4 | 69 //for all parameters see if the user has overruled it or use the default |
| 70 foreach ($Adefault as $i=>$d) { | |
| 71 $$i=isset($_GET[$i])?$_GET[$i]:$d; | |
| 72 } | |
| 73 //this is the data that is used to form the request for AWS | |
| 74 //this is the part that is search specific | |
| 75 $parameters=array( | |
| 76 'Operation' =>$operation , | |
| 77 //'Keywords' =>urlencode($search) , | |
| 78 //'SearchIndex' =>$searchindex , //Books for example. | |
| 79 "$searchparameter"=>$searchparameterdata , | |
| 80 'ItemPage' =>$page , //which page? | |
| 81 'AssociateTag' =>$Aassociates_id[$locale], | |
| 82 'ResponseGroup' =>'ItemAttributes,Reviews,EditorialReview,OfferSummary,Offers,Images,AlternateVersions,SalesRank,BrowseNodes' , //Small, Medium, Large or SellerListing,'BrowseNodes',// , | |
| 83 'ReviewSort' =>'-HelpfulVotes' | |
| 84 ); | |
| 85 | |
| 86 $ext=$Aserver[$locale]['ext']; | |
| 87 $file_data=$ext; | |
| 88 ksort($parameters); | |
| 89 foreach ($parameters as $i=>$d) { | |
| 90 $file_data.='&'.$i.'='.$d; | |
| 91 } | |
| 92 | |
| 93 $url=aws_signed_request($ext,$parameters,$public_key,$private_key); | |
| 94 //echo $url; | |
| 95 $crl = curl_init(); | |
| 96 $timeout = 5; | |
| 97 curl_setopt ($crl, CURLOPT_URL,$url); | |
| 98 curl_setopt ($crl, CURLOPT_ENCODING , "gzip"); | |
| 99 curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1); | |
| 100 curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); | |
| 5 | 101 /* $timeDiff=((int)(microtime(true)*1000))-$lastReqTime; |
| 102 if ($timeDiff<1000) { | |
| 103 usleep((1000-$timeDiff)*1000); // microseconds | |
| 104 }*/ | |
| 4 | 105 $output = curl_exec($crl); |
| 5 | 106 //$lastReqTime=(int)(microtime(true)*1000); // milliseconds |
| 4 | 107 curl_close($crl); |
| 108 | |
| 109 /*$xml = new SimpleXMLElement("<?xml version=\"1.0\"?><ItemLookupErrorResponse xmlns=\"http://ecs.amazonaws.com/doc/2009-03-31/\"><Error><Code>AccountLimitExceeded</Code><Message>Account limit of 2056 requests per hour exceeded.</Message></Error><RequestID>290ed059-730c-4789-93b4-6d21e11053d3</RequestID></ItemLookupErrorResponse>");*/ | |
| 110 $review = ""; | |
| 19 | 111 $review1 = ""; |
| 112 $review2 = ""; | |
| 113 $review3 = ""; | |
| 5 | 114 // HST added this |
| 115 if (preg_match("<Error>",$output)) { | |
| 116 $xml = new SimpleXMLElement($output); | |
| 117 $resName=$xml->getName(); | |
| 118 $code=$xml->Error->Code; | |
|
9
232deb0b066a
tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents:
7
diff
changeset
|
119 file_put_contents('/var/ywww/debug/phpDebug',"Losing: $resName, $code\n",FILE_APPEND); |
|
7
1dfe64e365a0
a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents:
5
diff
changeset
|
120 if ($code=='RequestThrottled') { |
|
1dfe64e365a0
a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents:
5
diff
changeset
|
121 usleep(200000); // Try to reduce throttling until we get a |
|
1dfe64e365a0
a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents:
5
diff
changeset
|
122 // principled solution in place |
|
1dfe64e365a0
a bit more debugging/bomb-proofing
Robert Boland <robert@markup.co.uk>
parents:
5
diff
changeset
|
123 } |
|
9
232deb0b066a
tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents:
7
diff
changeset
|
124 else { |
| 18 | 125 file_put_contents('/var/ywww/debug/phpDebug',"parms: $go\nurl: $url\n". |
|
9
232deb0b066a
tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents:
7
diff
changeset
|
126 print_r($parameters,TRUE)."\n",FILE_APPEND); |
|
10
5aa24c984a3b
if no code show entire response
Henry S. Thompson <ht@markup.co.uk>
parents:
9
diff
changeset
|
127 if ($code=="") { |
|
11
c9ebf871114b
fix wrong var in debug output
Henry S. Thompson <ht@markup.co.uk>
parents:
10
diff
changeset
|
128 file_put_contents('/var/ywww/debug/phpDebug',"error elt:\n$output\n",FILE_APPEND); |
|
10
5aa24c984a3b
if no code show entire response
Henry S. Thompson <ht@markup.co.uk>
parents:
9
diff
changeset
|
129 } |
|
9
232deb0b066a
tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents:
7
diff
changeset
|
130 } |
| 5 | 131 } |
| 132 else { | |
| 133 $xml = new SimpleXMLElement($output); | |
| 134 set_error_handler(function () { | |
| 135 global $output; | |
| 136 file_put_contents('/var/ywww/debug/phpDebug', | |
| 137 "Caught one?: ".$searchparameterdata, | |
| 138 FILE_APPEND); | |
| 139 file_put_contents('/var/ywww/debug/phpDebug', | |
| 140 print_r($output, TRUE)."\n", | |
| 141 FILE_APPEND); | |
| 4 | 142 } ); |
| 5 | 143 $review = $xml->Items->Item->CustomerReviews->IFrameURL; |
| 144 // The above is failing repeatedly -- | |
| 145 //PHP Notice: Trying to get property of non-object in | |
| 146 // /var/ywww/xml/getAmazonInfo.php on line [109] | |
| 147 // See the dumped structure at the end of this file for the | |
| 148 // cause | |
| 149 restore_error_handler(); | |
| 150 //echo $review; | |
| 151 } | |
| 4 | 152 if ($review != "") |
| 153 { | |
| 154 $text = @file_get_contents($review . "&truncate=300"); | |
| 155 $removeTop1 = preg_replace('~<div class="crIFrameHeaderLeftColumn">(.*?)<div class="crIFrameHeaderHistogram">~si', '', $text); | |
| 156 $removeTop2 = preg_replace('~<div class="crIFrameHeaderHistogram">(.*?)<div class="crIframeReviewList">~si', '', $text); | |
| 157 if (preg_match('~<body[^>]*>(.*?)</body>~si', $removeTop2, $body)){ $getBody = trim($body[1]); } | |
| 158 $removeDiv = preg_replace('~<div[^>]*>(.*?)</div>~si', '', $getBody); | |
| 159 $removeCloseDivs = preg_replace('/<\/div>/','', $removeDiv); | |
| 160 $setBoundary = str_replace('<!-- BOUNDARY -->','BOTTOM-TOP', $removeCloseDivs); | |
| 161 //replace <!-- BOUNDARY --> with BOTTOM-TOP | |
| 162 $remove1 = '~<table cellpadding="0"(.*?)%">~s'; | |
| 163 $setBoundary = preg_replace($remove1,'', $setBoundary); | |
| 164 $remove2 = '~</td><td bg(.*?)</table>~s'; | |
| 165 $setBoundary = preg_replace($remove2,'', $setBoundary); | |
| 166 $remove3 = '~<a name=(.*?)</a>~s'; | |
| 167 $setBoundary = preg_replace($remove3,'', $setBoundary); | |
| 168 $setBoundary2 = str_replace('<br />','', $setBoundary); | |
| 169 //remove all extra crap; | |
| 170 $setBoundary3 = str_replace('</td>','BOTTOM', $setBoundary2); | |
| 171 //replace </td> with BOTTOM | |
| 172 | |
| 173 if (preg_match_all('~TOP(.*?)BOTTOM~s', $setBoundary3, $reviews)) | |
| 174 { | |
| 175 $reviewContents = $reviews[1]; | |
| 176 //print_r($reviewContents); | |
| 177 $review1 = trim($reviewContents[0]); | |
| 178 $review1 = str_replace("\n", "", $review1); | |
| 179 $review1 = str_replace("\r", "", $review1); | |
| 180 if (isset($reviewContents[1])) { | |
| 181 $review2 = trim($reviewContents[1]); | |
| 182 $review2 = str_replace("\n", "", $review2); | |
| 183 $review2 = str_replace("\r", "", $review2); | |
| 184 } | |
| 185 else { | |
| 186 $review2 = ""; | |
| 187 } | |
| 188 if (isset($reviewContents[2])) { | |
| 189 $review3 = trim($reviewContents[2]); | |
| 190 $review3 = str_replace("\n", "", $review3); | |
| 191 $review3 = str_replace("\r", "", $review3); | |
| 192 } | |
| 193 else { | |
| 194 $review3 = ""; | |
| 195 } | |
| 196 } | |
| 197 else | |
| 198 { | |
| 199 $review1 = ""; | |
| 200 $review2 = ""; | |
| 201 $review3 = ""; | |
| 202 //echo "EPIC FAIL"; | |
| 203 } | |
| 204 | |
| 205 unset($xml->Items->Item->CustomerReviews); | |
| 206 $xdoc = new DomDocument; | |
| 207 $xdoc->loadXML($xml->asXML()); | |
| 208 | |
| 209 $cReviews = $xdoc ->createElement('CustomerReviews'); | |
| 210 $cReviewHolder = $xdoc ->createElement('Review'); | |
| 211 $cReview = $xdoc ->createElement('Content'); | |
| 212 $cReviewHolder2 = $xdoc ->createElement('Review'); | |
| 213 $cReview2 = $xdoc ->createElement('Content'); | |
| 214 $cReviewHolder3 = $xdoc ->createElement('Review'); | |
| 215 $cReview3 = $xdoc ->createElement('Content'); | |
| 216 | |
| 217 $txtNode = $xdoc ->createTextNode ($review1); | |
| 218 $cReview -> appendChild($txtNode); | |
| 219 | |
| 220 $txtNode2 = $xdoc ->createTextNode ($review2); | |
| 221 $cReview2 -> appendChild($txtNode2); | |
| 222 | |
| 223 $txtNode3 = $xdoc ->createTextNode ($review3); | |
| 224 $cReview3 -> appendChild($txtNode3); | |
| 225 | |
| 226 $cReviewHolder -> appendChild($cReview); | |
| 227 $cReviewHolder2 -> appendChild($cReview2); | |
| 228 $cReviewHolder3 -> appendChild($cReview3); | |
| 229 | |
| 230 $cReviews -> appendChild($cReviewHolder); | |
| 231 $cReviews -> appendChild($cReviewHolder2); | |
| 232 $cReviews -> appendChild($cReviewHolder3); | |
| 233 | |
| 234 $xdoc->documentElement->childNodes->item(1)->childNodes->item(1)->appendChild($cReviews); | |
| 235 $newXML = simplexml_import_dom($xdoc); | |
| 236 $output = $newXML->asXml(); | |
| 237 } | |
| 238 | |
| 239 switch($locale){ | |
| 240 case "us": | |
| 241 $loc = 0; | |
| 242 break; | |
| 243 case "uk": | |
| 244 $loc = 1; | |
| 245 break; | |
| 246 case "ca": | |
| 247 $loc = 2; | |
| 248 break; | |
| 249 case "de": | |
| 250 $loc = 3; | |
| 251 break; | |
| 252 case "fr": | |
| 253 $loc = 4; | |
| 254 break; | |
| 255 }; | |
| 256 | |
| 257 $errorCode = $xml->Error->Code; | |
| 258 //echo $errorCode; | |
| 259 | |
| 260 if($errorCode != "AccountLimitExceeded") | |
| 261 { | |
| 5 | 262 if($go == 1) { |
| 19 | 263 $item = $xml->Items->Item[0]; |
| 264 if ($item && $item->ItemAttributes && $item->ItemAttributes->Title) { | |
| 265 $title = $item->ItemAttributes->Title; } | |
| 266 else { $title = "[no title]"; }; | |
| 5 | 267 file_put_contents('/var/ywww/debug/phpDebug',"win: ". |
| 19 | 268 $title."\n", |
| 5 | 269 FILE_APPEND); |
| 4 | 270 return $output; |
| 5 | 271 } |
| 19 | 272 else |
| 273 { | |
| 274 if ($xml->Items->Item) { | |
| 275 $title = $xml->Items->Item[0]->ItemAttributes->Title; | |
| 276 $author = $xml->Items->Item[0]->ItemAttributes->Author; | |
| 277 $binding = $xml->Items->Item[0]->ItemAttributes->Binding; | |
| 278 $dewey = $xml->Items->Item[0]->ItemAttributes->DeweyDecimalNumber; | |
| 279 if($dewey == "") | |
| 280 $dewey = "null"; | |
| 281 $imageURL = $xml->Items->Item[0]->MediumImage->URL; | |
| 282 $salesRank = $xml->Items->Item[0]->SalesRank; | |
| 283 $pubDate = $xml->Items->Item[0]->ItemAttributes->PublicationDate; | |
| 284 $publisher = $xml->Items->Item[0]->ItemAttributes->Publisher; | |
| 285 } | |
| 286 else { | |
| 287 $title = $salesRank = ""; | |
| 288 $dewey = "null"; | |
| 289 } | |
| 4 | 290 |
| 19 | 291 $genreID = ""; |
| 292 $genre = ""; | |
| 293 $genArr = array(); | |
| 294 | |
| 295 if ($xml->Items->Item[0] && $xml->Items->Item[0]->BrowseNodes) { | |
| 296 for($i=0;$i<sizeof($xml->Items->Item->BrowseNodes->BrowseNode);$i++){ | |
| 297 //sexy recursive function | |
| 298 findGenre($xml->Items->Item->BrowseNodes->BrowseNode[$i], $genreID, $genre); | |
| 4 | 299 |
| 19 | 300 if($genre != "") |
| 301 $genArr[strval($genreID)] = strval($genre); | |
| 302 //$genArr[$i] = array(strval($genreID) => strval($genre)); | |
| 4 | 303 |
| 19 | 304 //echo $genre; |
| 305 //echo $genreID; | |
| 4 | 306 |
| 19 | 307 $genre = ""; |
| 308 $genreID = ""; | |
| 309 } | |
| 310 } | |
| 4 | 311 |
| 19 | 312 $g1 = "null"; |
| 313 $g2 = "null"; | |
| 314 $g3 = "null"; | |
| 315 $loop = 1; | |
| 4 | 316 |
| 19 | 317 foreach ($genArr as $key => $value) { |
| 318 //echo "$key => $value"; | |
| 319 $queryG = "CALL b_addBrowseNode($key,\"$value\")"; //add the name value pair for genre to new table | |
| 320 //echo $queryG; | |
| 321 include "../../private/db.php"; | |
| 322 $resG = mysqli_query($link, $queryG); | |
| 323 mysqli_close($link); | |
| 4 | 324 |
| 19 | 325 switch ($loop) { |
| 326 case 1: | |
| 327 $g1 = $key; | |
| 328 break; | |
| 329 case 2: | |
| 330 $g2 = $key; | |
| 331 break; | |
| 332 case 3: | |
| 333 $g3 = $key; | |
| 334 break; | |
| 335 } | |
| 4 | 336 |
| 19 | 337 $loop++; |
| 338 } | |
| 4 | 339 |
| 19 | 340 if($salesRank == "") |
| 341 $salesRank = "null"; | |
| 4 | 342 |
| 19 | 343 $title = strtr($title, '"', "'"); |
| 344 include "../../private/db.php"; | |
| 345 $review1 = mysqli_real_escape_string($link,$review1); | |
| 346 $review2 = mysqli_real_escape_string($link,$review2); | |
| 347 $review3 = mysqli_real_escape_string($link,$review3); | |
| 4 | 348 |
| 19 | 349 if($title != "") |
| 350 { | |
| 351 $queryInsert = "CALL b_addNewBook(\"$searchparameterdata\",\"$title\", \"$author\",\"$binding\",\"$imageURL\", $dewey, $salesRank,\"$pubDate\",\"$publisher\",$g1,$g2,$g3,$loc)"; | |
| 352 //echo $queryInsert; | |
| 353 $queryInsertReviews = "CALL b_insertReviews(\"$searchparameterdata\",\"$review1\",\"$review2\",\"$review3\")"; | |
| 4 | 354 |
| 19 | 355 $resG = mysqli_query($link, $queryInsert) or exit( mysqli_error( $link )); |
| 356 if($review1 != "" && $review2 != "" && $review3 != "") | |
| 357 $resG = mysqli_query($link, $queryInsertReviews) or exit( mysqli_error( $link )); | |
| 4 | 358 |
| 19 | 359 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop |
| 360 } | |
| 4 | 361 |
| 19 | 362 echo $output; |
| 363 } | |
| 4 | 364 } |
| 365 else | |
| 366 { | |
| 367 //look up info from db | |
| 368 include "../../private/db.php"; | |
| 369 $query = "CALL b_getBookInfo('$searchparameterdata', $loc)"; | |
| 370 //echo $query; | |
| 371 $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); | |
| 372 | |
| 373 $output = ""; | |
| 374 $output .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; | |
| 375 $output .= "<Details>"; | |
| 376 if ( mysqli_num_rows( $res ) > 0 ) | |
| 377 { | |
| 378 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC); | |
| 379 | |
| 380 $output .= "<ASIN>" . $searchparameterdata . "</ASIN>"; | |
| 381 $output .= "<Title>" . htmlspecialchars($rows["Title"]) . "</Title>"; | |
| 382 $output .= "<Author>" . htmlspecialchars($rows["Author"]) . "</Author>"; | |
| 383 $output .= "<Binding>" . htmlspecialchars($rows["Binding"]) . "</Binding>"; | |
| 384 $output .= "<Dewey>" . htmlspecialchars($rows["DeweyDecimal"]) . "</Dewey>"; | |
| 385 $output .= "<ImageURL>" . htmlspecialchars($rows["ImageURL"]) . "</ImageURL>"; | |
| 386 $output .= "<SalesRank>" . htmlspecialchars($rows["SalesRank"]) . "</SalesRank>"; | |
| 387 $output .= "<PublicationDate>" . htmlspecialchars($rows["PublicationDate"]) . "</PublicationDate>"; | |
| 388 $output .= "<Publisher>" . htmlspecialchars($rows["Publisher"]) . "</Publisher>"; | |
| 389 $output .= "<Genre1>" . htmlspecialchars($rows["Genre1"]) . "</Genre1>"; | |
| 390 $output .= "<Genre2>" . htmlspecialchars($rows["Genre2"]) . "</Genre2>"; | |
| 391 $output .= "<Genre3>" . htmlspecialchars($rows["Genre3"]) . "</Genre3>"; | |
| 392 $output .= "<ProductGroup>Book</ProductGroup>"; | |
| 393 $output .= "<Error>AccountLimitExceeded</Error>"; | |
| 394 | |
| 395 } | |
| 396 $output .= "</Details>"; | |
| 397 echo $output; | |
| 398 } | |
| 399 } | |
| 400 | |
| 401 function findGenre($browseNode, &$ID, &$gen) | |
| 402 { | |
| 403 if($browseNode->Name == "Subjects") | |
| 404 { | |
| 405 return true; | |
| 406 } | |
| 407 else | |
| 408 { | |
| 409 if($browseNode->Ancestors->BrowseNode) | |
| 410 { | |
| 411 if(findGenre($browseNode->Ancestors->BrowseNode, $ID, $gen) == true) | |
| 412 { | |
| 413 $gen = $browseNode->Name; | |
| 414 $ID = $browseNode->BrowseNodeId; | |
| 415 } | |
| 416 } | |
| 417 return false; | |
| 418 } | |
| 419 } | |
| 420 | |
| 421 if(!isset($ret)) | |
| 422 { | |
| 423 include "aws_signed_request.php"; | |
| 424 getAmazonDet('default',0,'us'); //will get overwritten | |
| 425 } | |
| 426 /*Caught oneSimpleXMLElement Object | |
| 427 ( | |
| 428 [OperationRequest] => SimpleXMLElement Object | |
| 429 ( | |
| 430 [RequestId] => d2eaacba-2411-44e7-b268-f23a20167330 | |
| 431 [Arguments] => SimpleXMLElement Object | |
| 432 ( | |
| 433 [Argument] => Array | |
| 434 ( | |
| 435 [0] => SimpleXMLElement Object | |
| 436 ( | |
| 437 [@attributes] => Array | |
| 438 ( | |
| 439 [Name] => AWSAccessKeyId | |
|
17
ae1459564f66
Replace old associate keys with new IAMs user keys
Robert Boland <robert@markup.co.uk>
parents:
11
diff
changeset
|
440 [Value] => AKIAIHTNWC7L6LOUY4LQ |
| 4 | 441 ) |
| 442 | |
| 443 ) | |
| 444 | |
| 445 [1] => SimpleXMLElement Object | |
| 446 ( | |
| 447 [@attributes] => Array | |
| 448 ( | |
| 449 [Name] => AssociateTag | |
| 450 [Value] => bookwhack-21 | |
| 451 ) | |
| 452 | |
| 453 ) | |
| 454 | |
| 455 [2] => SimpleXMLElement Object | |
| 456 ( | |
| 457 [@attributes] => Array | |
| 458 ( | |
| 459 [Name] => ItemId | |
| 460 [Value] => B004Q3Q3Y4 | |
| 461 ) | |
| 462 | |
| 463 ) | |
| 464 | |
| 465 [3] => SimpleXMLElement Object | |
| 466 ( | |
| 467 [@attributes] => Array | |
| 468 ( | |
| 469 [Name] => ItemPage | |
| 470 [Value] => 1 | |
| 471 ) | |
| 472 | |
| 473 ) | |
| 474 | |
| 475 [4] => SimpleXMLElement Object | |
| 476 ( | |
| 477 [@attributes] => Array | |
| 478 ( | |
| 479 [Name] => Operation | |
| 480 [Value] => ItemLookup | |
| 481 ) | |
| 482 | |
| 483 ) | |
| 484 | |
| 485 [5] => SimpleXMLElement Object | |
| 486 ( | |
| 487 [@attributes] => Array | |
| 488 ( | |
| 489 [Name] => ResponseGroup | |
| 490 [Value] => ItemAttributes,Reviews,EditorialReview,OfferSummary,Offers,Images,AlternateVersions,SalesRank,BrowseNodes | |
| 491 ) | |
| 492 | |
| 493 ) | |
| 494 | |
| 495 [6] => SimpleXMLElement Object | |
| 496 ( | |
| 497 [@attributes] => Array | |
| 498 ( | |
| 499 [Name] => ReviewSort | |
| 500 [Value] => -HelpfulVotes | |
| 501 ) | |
| 502 | |
| 503 ) | |
| 504 | |
| 505 [7] => SimpleXMLElement Object | |
| 506 ( | |
| 507 [@attributes] => Array | |
| 508 ( | |
| 509 [Name] => Service | |
| 510 [Value] => AWSECommerceService | |
| 511 ) | |
| 512 | |
| 513 ) | |
| 514 | |
| 515 [8] => SimpleXMLElement Object | |
| 516 ( | |
| 517 [@attributes] => Array | |
| 518 ( | |
| 519 [Name] => Timestamp | |
| 520 [Value] => 2016-12-15T23:12:34Z | |
| 521 ) | |
| 522 | |
| 523 ) | |
| 524 | |
| 525 [9] => SimpleXMLElement Object | |
| 526 ( | |
| 527 [@attributes] => Array | |
| 528 ( | |
| 529 [Name] => Version | |
| 530 [Value] => 2011-08-01 | |
| 531 ) | |
| 532 | |
| 533 ) | |
| 534 | |
| 535 [10] => SimpleXMLElement Object | |
| 536 ( | |
| 537 [@attributes] => Array | |
| 538 ( | |
| 539 [Name] => Signature | |
| 540 [Value] => SUXfFZHQ74Joc+WDLx87uzemTdtHijNohykqafJXYKQ= | |
| 541 ) | |
| 542 | |
| 543 ) | |
| 544 | |
| 545 ) | |
| 546 | |
| 547 ) | |
| 548 | |
| 549 [RequestProcessingTime] => 0.3518217620000000 | |
| 550 ) | |
| 551 | |
| 552 [Items] => SimpleXMLElement Object | |
| 553 ( | |
| 554 [Request] => SimpleXMLElement Object | |
| 555 ( | |
| 556 [IsValid] => True | |
| 557 [ItemLookupRequest] => SimpleXMLElement Object | |
| 558 ( | |
| 559 [IdType] => ASIN | |
| 560 [ItemId] => B004Q3Q3Y4 | |
| 561 [ResponseGroup] => Array | |
| 562 ( | |
| 563 [0] => ItemAttributes | |
| 564 [1] => Reviews | |
| 565 [2] => EditorialReview | |
| 566 [3] => OfferSummary | |
| 567 [4] => Offers | |
| 568 [5] => Images | |
| 569 [6] => AlternateVersions | |
| 570 [7] => SalesRank | |
| 571 [8] => BrowseNodes | |
| 572 ) | |
| 573 | |
| 574 [VariationPage] => All | |
| 575 ) | |
| 576 | |
| 577 [Errors] => SimpleXMLElement Object | |
| 578 ( | |
| 579 [Error] => SimpleXMLElement Object | |
| 580 ( | |
| 581 [Code] => AWS.InvalidParameterValue | |
| 582 [Message] => B004Q3Q3Y4 is not a valid value for ItemId. Please change this value and retry your request. | |
| 583 ) | |
| 584 | |
| 585 ) | |
| 586 | |
| 587 ) | |
| 588 | |
| 589 ) | |
| 590 | |
| 591 ) | |
| 592 */ | |
| 593 ?> |
