comparison xml/doAmazonRequest.php @ 55:72708ec9c0e6

debug bad XML error
author Charlie Root
date Fri, 07 Jun 2019 16:35:35 -0400
parents dd93cb4b77ad
children e4c78b3eace7
comparison
equal deleted inserted replaced
54:a04fc91bbd95 55:72708ec9c0e6
48 usleep(1000000); 48 usleep(1000000);
49 $output = curl_exec($crl); 49 $output = curl_exec($crl);
50 dl("nai2: $gotit ".strlen($output)."\n"); 50 dl("nai2: $gotit ".strlen($output)."\n");
51 curl_close($crl); 51 curl_close($crl);
52 $mm=array(); 52 $mm=array();
53 $xml = new SimpleXMLElement($output); 53 try {
54 $xml = new SimpleXMLElement($output);
55 }
56 catch (Exception $e) {
57 dl("dar: bad output:\n$output\n");
58 throw $e;
59 }
54 if (preg_match("/<Error>/",$output,$mm)) { 60 if (preg_match("/<Error>/",$output,$mm)) {
55 $resName=$xml->getName(); 61 $resName=$xml->getName();
56 $code=$xml->Error->Code; 62 $code=$xml->Error->Code;
57 if ($code) { 63 if ($code) {
58 $message=$xml->Error->Message; 64 $message=$xml->Error->Message;