Mercurial > hg > ywww
comparison xml/getAmazonInfo.php @ 9:232deb0b066a
tidy up debugging, only show parms on non-throttled error
| author | Henry S. Thompson <ht@markup.co.uk> |
|---|---|
| date | Sat, 18 Feb 2017 11:38:36 +0000 |
| parents | 1dfe64e365a0 |
| children | 5aa24c984a3b |
comparison
equal
deleted
inserted
replaced
| 8:226f00d9f6f5 | 9:232deb0b066a |
|---|---|
| 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); | |
| 125 } | 126 } |
| 126 } | 127 } |
| 127 else { | 128 else { |
| 128 $xml = new SimpleXMLElement($output); | 129 $xml = new SimpleXMLElement($output); |
| 129 set_error_handler(function () { | 130 set_error_handler(function () { |
