Mercurial > hg > ywww
comparison xml/getAmazonInfo.php @ 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 | 86f79bc1d142 |
children | 3f400072bf14 |
comparison
equal
deleted
inserted
replaced
38:c24ae74bf6d5 | 39:2c0c95bd97a6 |
---|---|
59 function getAmazonDetRemote($go,$language,$locale,$loc, | 59 function getAmazonDetRemote($go,$language,$locale,$loc, |
60 $page,$operation,$searchparameter, | 60 $page,$operation,$searchparameter, |
61 $searchparameterdata, | 61 $searchparameterdata, |
62 $show_array,$show_url,$show_xml) | 62 $show_array,$show_url,$show_xml) |
63 { | 63 { |
64 global $output; | 64 global $output, $Aassociates_id, $Aserver; |
65 | |
66 $Aassociates_id=array( | |
67 'uk' => 'bookwhack-21', | |
68 'us' => 'your02b-20', | |
69 'ca' => 'book009-20', | |
70 'de' => 'book04c-21', | |
71 'fr' => 'book07f-21', | |
72 ); | |
73 | |
74 $Aserver=array( | |
75 'ca' => array( | |
76 'ext' => 'ca' , //Canadian normal server | |
77 'nor' => 'http://www.amazon.ca' , //Canadian normal server | |
78 'xml' => 'http://xml.amazon.com' , //Canadian xml server | |
79 ), | |
80 'de' => array( | |
81 'ext' => 'de' , //German normal server | |
82 'nor' => 'http://www.amazon.de' , //German normal server | |
83 'xml' => 'http://xml-eu.amazon.com', //German xml server | |
84 ), | |
85 'fr' => array( | |
86 'ext' => 'fr' , //French normal server | |
87 'nor' => 'http://www.amazon.fr' , //French normal server | |
88 'xml' => 'http://xml-eu.amazon.com', //French xml server | |
89 ), | |
90 'jp' => array( | |
91 'ext' => 'jp' , //Japanese normal server, not co.jp! | |
92 'nor' => 'http://www.amazon.co.jp' , //Japanese normal server | |
93 'xml' => 'http://xml.amazon.com' , //Japanese xml server | |
94 ), | |
95 'uk' => array( | |
96 'ext' => 'co.uk' , //UK normal server | |
97 'nor' => 'http://www.amazon.co.uk' , //UK normal server | |
98 'xml' => 'http://xml-eu.amazon.com', //UK xml server | |
99 ), | |
100 'us' => array( | |
101 'ext' => 'com' , //USA normal server | |
102 'nor' => 'http://www.amazon.com' , //USA normal server | |
103 'xml' => 'http://xml.amazon.com' , //USA xml server | |
104 ), | |
105 ); | |
106 | 65 |
107 //if(go != 1) | 66 //if(go != 1) |
108 //include "aws_signed_request.php"; | 67 //include "aws_signed_request.php"; |
109 //this is the data that is used to form the request for AWS | 68 //this is the data that is used to form the request for AWS |
110 //this is the part that is search specific | 69 //this is the part that is search specific |
124 // that caused an error: | 83 // that caused an error: |
125 // If idType equals ASIN, SearchIndex cannot be present | 84 // If idType equals ASIN, SearchIndex cannot be present |
126 //'SearchIndex' =>$searchindex , //Books for example. | 85 //'SearchIndex' =>$searchindex , //Books for example. |
127 $parameters['SearchIndex']=$searchindex; | 86 $parameters['SearchIndex']=$searchindex; |
128 } | 87 } |
129 $xml=doAmazonRequest($Aserver[$locale]['ext'],$parameters,3); // may throw exception | 88 $xml=doAmazonRequest($Aserver[$locale]['ext'],$parameters,3,'i'); // may throw exception |
130 set_error_handler(function () { | 89 set_error_handler(function () { |
131 global $output; | 90 global $output; |
132 file_put_contents('/var/ywww/debug/phpDebug', | 91 file_put_contents('/var/ywww/debug/phpDebug', |
133 "Caught one?: ".$searchparameterdata, | 92 "Caught one?: ".$searchparameterdata, |
134 FILE_APPEND); | 93 FILE_APPEND); |
448 } | 407 } |
449 } | 408 } |
450 | 409 |
451 if(!isset($ret)) | 410 if(!isset($ret)) |
452 { | 411 { |
453 include "aws_signed_request.php"; | 412 include "aws_signed_request.php"; |
454 getAmazonDet('default',0,'us'); //will get overwritten | 413 getAmazonDet('default',0,'us'); //will get overwritten from URI params |
414 // by the foreach ($Adefault as ... loop above | |
455 } | 415 } |
456 /*Caught oneSimpleXMLElement Object | 416 /*Caught oneSimpleXMLElement Object |
457 ( | 417 ( |
458 [OperationRequest] => SimpleXMLElement Object | 418 [OperationRequest] => SimpleXMLElement Object |
459 ( | 419 ( |