comparison xml/getAmazonInfo.php @ 13:b78209a5fba1

Merge
author Rob Boland <robert@metail.co.uk>
date Sat, 18 Feb 2017 15:18:47 +0000
parents c9ebf871114b
children 385ddd7c4b55 ae1459564f66 77ff181476b8
comparison
equal deleted inserted replaced
12:970a4834afff 13:b78209a5fba1
92 $file_data.='&'.$i.'='.$d; 92 $file_data.='&'.$i.'='.$d;
93 } 93 }
94 94
95 $url=aws_signed_request($ext,$parameters,$public_key,$private_key); 95 $url=aws_signed_request($ext,$parameters,$public_key,$private_key);
96 //echo $url; 96 //echo $url;
97 file_put_contents('/var/ywww/debug/phpDebug',"parms: $go".
98 print_r($parameters,TRUE)."\n",FILE_APPEND);
99 $crl = curl_init(); 97 $crl = curl_init();
100 $timeout = 5; 98 $timeout = 5;
101 curl_setopt ($crl, CURLOPT_URL,$url); 99 curl_setopt ($crl, CURLOPT_URL,$url);
102 curl_setopt ($crl, CURLOPT_ENCODING , "gzip"); 100 curl_setopt ($crl, CURLOPT_ENCODING , "gzip");
103 curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1); 101 curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
115 // HST added this 113 // HST added this
116 if (preg_match("<Error>",$output)) { 114 if (preg_match("<Error>",$output)) {
117 $xml = new SimpleXMLElement($output); 115 $xml = new SimpleXMLElement($output);
118 $resName=$xml->getName(); 116 $resName=$xml->getName();
119 $code=$xml->Error->Code; 117 $code=$xml->Error->Code;
120 file_put_contents('/var/ywww/debug/phpDebug',"Losing: $resName, ". 118 file_put_contents('/var/ywww/debug/phpDebug',"Losing: $resName, $code\n",FILE_APPEND);
121 $code."\n",FILE_APPEND);
122 if ($code=='RequestThrottled') { 119 if ($code=='RequestThrottled') {
123 usleep(200000); // Try to reduce throttling until we get a 120 usleep(200000); // Try to reduce throttling until we get a
124 // principled solution in place 121 // principled solution in place
122 }
123 else {
124 file_put_contents('/var/ywww/debug/phpDebug',"parms: $go\n".
125 print_r($parameters,TRUE)."\n",FILE_APPEND);
126 if ($code=="") {
127 file_put_contents('/var/ywww/debug/phpDebug',"error elt:\n$output\n",FILE_APPEND);
128 }
125 } 129 }
126 } 130 }
127 else { 131 else {
128 $xml = new SimpleXMLElement($output); 132 $xml = new SimpleXMLElement($output);
129 set_error_handler(function () { 133 set_error_handler(function () {