# HG changeset patch
# User robert
# Date 1482930452 0
# Node ID 55445b456ad0abbfd1e17a7f21843ecb5a91ddaf
# Parent a6b55ae706174f41980134bd6f4c2ac09b0b4da8
short-circuit error response handling, add debugging
diff -r a6b55ae70617 -r 55445b456ad0 xml/getAmazonInfo.php
--- a/xml/getAmazonInfo.php Wed Dec 28 13:04:53 2016 +0000
+++ b/xml/getAmazonInfo.php Wed Dec 28 13:07:32 2016 +0000
@@ -1,5 +1,6 @@
AccountLimitExceeded
Account limit of 2056 requests per hour exceeded.290ed059-730c-4789-93b4-6d21e11053d3");*/
- $xml = new SimpleXMLElement($output);
$review = "";
- set_error_handler(function () {
- global $output;
- file_put_contents('/var/ywww/debug/phpDebug', "Caught one: ",FILE_APPEND);
- file_put_contents('/var/ywww/debug/phpDebug',
- print_r($output, TRUE)."\n",
- FILE_APPEND);
+ // HST added this
+ if (preg_match("",$output)) {
+ $xml = new SimpleXMLElement($output);
+ $resName=$xml->getName();
+ $code=$xml->Error->Code;
+ file_put_contents('/var/ywww/debug/phpDebug',"Losing: $resName, ".
+ $xml->Error->Code."\n",FILE_APPEND);
+ }
+ else {
+ $xml = new SimpleXMLElement($output);
+ set_error_handler(function () {
+ global $output;
+ file_put_contents('/var/ywww/debug/phpDebug',
+ "Caught one?: ".$searchparameterdata,
+ FILE_APPEND);
+ file_put_contents('/var/ywww/debug/phpDebug',
+ print_r($output, TRUE)."\n",
+ FILE_APPEND);
} );
- $review = $xml->Items->Item->CustomerReviews->IFrameURL;
- // The above is failing repeatedly --
- //PHP Notice: Trying to get property of non-object in
- // /var/ywww/xml/getAmazonInfo.php on line [109]
- // See the dumped structure at the end of this file for the
- // cause
- restore_error_handler();
- //echo $review;
- $review1 = "";
- $review2 = "";
- $review3 = "";
+ $review = $xml->Items->Item->CustomerReviews->IFrameURL;
+ // The above is failing repeatedly --
+ //PHP Notice: Trying to get property of non-object in
+ // /var/ywww/xml/getAmazonInfo.php on line [109]
+ // See the dumped structure at the end of this file for the
+ // cause
+ restore_error_handler();
+ //echo $review;
+ $review1 = "";
+ $review2 = "";
+ $review3 = "";
+ }
if ($review != "")
{
$text = @file_get_contents($review . "&truncate=300");
@@ -235,8 +253,12 @@
if($errorCode != "AccountLimitExceeded")
{
- if($go == 1)
+ if($go == 1) {
+ file_put_contents('/var/ywww/debug/phpDebug',"win: ".
+ $xml->Items->Item->ItemAttributes->Title."\n",
+ FILE_APPEND);
return $output;
+ }
else
{
$title = $xml->Items->Item->ItemAttributes->Title;