comparison us/index.php @ 8:226f00d9f6f5

another error check
author Henry Thompson <ht@markup.co.uk>
date Fri, 17 Feb 2017 15:22:53 +0000
parents 1dfe64e365a0
children 385ddd7c4b55 84a412b8122c
comparison
equal deleted inserted replaced
7:1dfe64e365a0 8:226f00d9f6f5
138 } 138 }
139 else 139 else
140 { 140 {
141 $bookDetails = getAmazonDet($isbn,1,'us'); 141 $bookDetails = getAmazonDet($isbn,1,'us');
142 $bookXML = new SimpleXMLElement($bookDetails); 142 $bookXML = new SimpleXMLElement($bookDetails);
143 $title = $bookXML->Items->Item[0]->ItemAttributes->Title; 143 // HST added this
144 $author = $bookXML->Items->Item[0]->ItemAttributes->Author; 144 if (preg_match("<Error>",$bookDetails)) {
145 $resName=$bookXML->getName();
146 $code=$bookXML->Error->Code;
147 file_put_contents('/var/ywww/debug/phpDebug',"Losing 3: $resName, ".
148 $code."\n",FILE_APPEND);
149 if ($code=='RequestThrottled') {
150 usleep(200000); // Try to reduce throttling until we get a
151 // principled solution in place
152 }
153 $title = "";
154 }
155 else {
156 $title = $bookXML->Items->Item[0]->ItemAttributes->Title;
157 $author = $bookXML->Items->Item[0]->ItemAttributes->Author;
158 }
145 } 159 }
146 160
147 $linkedBooks = include "../php/read/getLinkedBooks.php"; 161 $linkedBooks = include "../php/read/getLinkedBooks.php";
148 $xml = new SimpleXMLElement($linkedBooks); 162 $xml = new SimpleXMLElement($linkedBooks);
149 163