changeset 39:2c0c95bd97a6

pass char for log lines in to doAmazonRequest, move static arrays to aws_s_r
author Charlie Root
date Fri, 04 Jan 2019 18:03:24 -0500
parents c24ae74bf6d5
children 3f400072bf14
files php/read/aws_signed_request.php xml/getAmazonInfo.php
diffstat 2 files changed, 48 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/php/read/aws_signed_request.php	Fri Jan 04 18:02:20 2019 -0500
+++ b/php/read/aws_signed_request.php	Fri Jan 04 18:03:24 2019 -0500
@@ -3,6 +3,49 @@
 //20090627/Jaap van Ganswijk: This is a modified version, see the
 //return statement some lines before the end of the last function.
 
+
+$Aassociates_id=array(
+		      'uk' => 'bookwhack-21',
+		      'us' => 'your02b-20',
+		      'ca' => 'book009-20',
+		      'de' => 'book04c-21',
+		      'fr' => 'book07f-21',
+		      );
+
+$Aserver=array(
+	       'ca' => array(
+			     'ext' => 'ca'                      ,  //Canadian normal server
+			     'nor' => 'http://www.amazon.ca'    ,  //Canadian normal server
+			     'xml' => 'http://xml.amazon.com'   ,  //Canadian xml server
+			     ),
+	       'de' => array(
+			     'ext' => 'de'                      ,  //German normal server
+			     'nor' => 'http://www.amazon.de'    ,  //German normal server
+			     'xml' => 'http://xml-eu.amazon.com',  //German xml server
+			     ),
+	       'fr' => array(
+			     'ext' => 'fr'                      ,  //French normal server
+			     'nor' => 'http://www.amazon.fr'    ,  //French normal server
+			     'xml' => 'http://xml-eu.amazon.com',  //French xml server
+			     ),
+	       'jp' => array(
+			     'ext' => 'jp'                      ,  //Japanese normal server, not co.jp!
+			     'nor' => 'http://www.amazon.co.jp' ,  //Japanese normal server
+			     'xml' => 'http://xml.amazon.com'   ,  //Japanese xml server
+			     ),
+	       'uk' => array(
+			     'ext' => 'co.uk'                   ,  //UK normal server
+			     'nor' => 'http://www.amazon.co.uk' ,  //UK normal server
+			     'xml' => 'http://xml-eu.amazon.com',  //UK xml server
+			     ),
+	       'us' => array(
+			     'ext' => 'com'                     ,  //USA normal server
+			     'nor' => 'http://www.amazon.com'   ,  //USA normal server
+			     'xml' => 'http://xml.amazon.com'   ,  //USA xml server
+			     ),
+	       );
+
+
 if (!function_exists("aws_signed_request")) {
 function aws_signed_request($region, $params, $public_key, $private_key)
 {
--- a/xml/getAmazonInfo.php	Fri Jan 04 18:02:20 2019 -0500
+++ b/xml/getAmazonInfo.php	Fri Jan 04 18:03:24 2019 -0500
@@ -61,48 +61,7 @@
 			    $searchparameterdata,
 			    $show_array,$show_url,$show_xml)
 {
-  global $output;
-
-  $Aassociates_id=array(
-			'uk' => 'bookwhack-21',
-			'us' => 'your02b-20',
-			'ca' => 'book009-20',
-			'de' => 'book04c-21',
-			'fr' => 'book07f-21',
-			);
-
-  $Aserver=array(
-		 'ca' => array(
-			       'ext' => 'ca'                      ,  //Canadian normal server
-			       'nor' => 'http://www.amazon.ca'    ,  //Canadian normal server
-			       'xml' => 'http://xml.amazon.com'   ,  //Canadian xml server
-			       ),
-		 'de' => array(
-			       'ext' => 'de'                      ,  //German normal server
-			       'nor' => 'http://www.amazon.de'    ,  //German normal server
-			       'xml' => 'http://xml-eu.amazon.com',  //German xml server
-			       ),
-		 'fr' => array(
-			       'ext' => 'fr'                      ,  //French normal server
-			       'nor' => 'http://www.amazon.fr'    ,  //French normal server
-			       'xml' => 'http://xml-eu.amazon.com',  //French xml server
-			       ),
-		 'jp' => array(
-			       'ext' => 'jp'                      ,  //Japanese normal server, not co.jp!
-			       'nor' => 'http://www.amazon.co.jp' ,  //Japanese normal server
-			       'xml' => 'http://xml.amazon.com'   ,  //Japanese xml server
-			       ),
-		 'uk' => array(
-			       'ext' => 'co.uk'                   ,  //UK normal server
-			       'nor' => 'http://www.amazon.co.uk' ,  //UK normal server
-			       'xml' => 'http://xml-eu.amazon.com',  //UK xml server
-			       ),
-		 'us' => array(
-			       'ext' => 'com'                     ,  //USA normal server
-			       'nor' => 'http://www.amazon.com'   ,  //USA normal server
-			       'xml' => 'http://xml.amazon.com'   ,  //USA xml server
-			       ),
-		 );
+  global $output, $Aassociates_id, $Aserver;
 
   //if(go != 1)
   //include "aws_signed_request.php";  
@@ -126,7 +85,7 @@
     //'SearchIndex'     =>$searchindex      ,  //Books for example.
     $parameters['SearchIndex']=$searchindex;
   }
-  $xml=doAmazonRequest($Aserver[$locale]['ext'],$parameters,3);  // may throw exception
+  $xml=doAmazonRequest($Aserver[$locale]['ext'],$parameters,3,'i');  // may throw exception
   set_error_handler(function () {
       global $output;
       file_put_contents('/var/ywww/debug/phpDebug',
@@ -450,8 +409,9 @@
 
 if(!isset($ret))
 {
-	include "aws_signed_request.php";  
-	getAmazonDet('default',0,'us');	//will get overwritten
+	include "aws_signed_request.php";
+	getAmazonDet('default',0,'us');	//will get overwritten from URI params
+	// by the foreach ($Adefault as ... loop above
 }
 /*Caught oneSimpleXMLElement Object
 (