annotate php/read/getBookDetails.php @ 21:46382face560

use a semaphore to try to cut down on RequestThrottled fails
author Charlie Root
date Thu, 25 Oct 2018 09:42:12 -0400
parents c41a5802b26c
children d606320ec331
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
45ae2aeb2b52 original
robert
parents:
diff changeset
1 <?php
45ae2aeb2b52 original
robert
parents:
diff changeset
2
45ae2aeb2b52 original
robert
parents:
diff changeset
3 function findGenre($browseNode, &$ID, &$gen)
45ae2aeb2b52 original
robert
parents:
diff changeset
4 {
45ae2aeb2b52 original
robert
parents:
diff changeset
5 if($browseNode->Name == "Subjects")
45ae2aeb2b52 original
robert
parents:
diff changeset
6 {
45ae2aeb2b52 original
robert
parents:
diff changeset
7 return true;
45ae2aeb2b52 original
robert
parents:
diff changeset
8 }
45ae2aeb2b52 original
robert
parents:
diff changeset
9 else
45ae2aeb2b52 original
robert
parents:
diff changeset
10 {
45ae2aeb2b52 original
robert
parents:
diff changeset
11 if($browseNode->Ancestors->BrowseNode)
45ae2aeb2b52 original
robert
parents:
diff changeset
12 {
45ae2aeb2b52 original
robert
parents:
diff changeset
13 if(findGenre($browseNode->Ancestors->BrowseNode, $ID, $gen) == true)
45ae2aeb2b52 original
robert
parents:
diff changeset
14 {
45ae2aeb2b52 original
robert
parents:
diff changeset
15 $gen = $browseNode->Name;
45ae2aeb2b52 original
robert
parents:
diff changeset
16 $ID = $browseNode->BrowseNodeId;
45ae2aeb2b52 original
robert
parents:
diff changeset
17
45ae2aeb2b52 original
robert
parents:
diff changeset
18 //if($browseNode->Name == "Literature & Fiction") //to return one level up the tree as well
45ae2aeb2b52 original
robert
parents:
diff changeset
19 // return true;
45ae2aeb2b52 original
robert
parents:
diff changeset
20 }
45ae2aeb2b52 original
robert
parents:
diff changeset
21 }
45ae2aeb2b52 original
robert
parents:
diff changeset
22 return false;
45ae2aeb2b52 original
robert
parents:
diff changeset
23 }
45ae2aeb2b52 original
robert
parents:
diff changeset
24 }
45ae2aeb2b52 original
robert
parents:
diff changeset
25
3
a5e5475bf357 fix ASIN pblm, add debugging
robert
parents: 2
diff changeset
26 global $out,$isbn;
2
45ae2aeb2b52 original
robert
parents:
diff changeset
27 if(isset($_GET['isbn'])){
45ae2aeb2b52 original
robert
parents:
diff changeset
28 $isbn = $_GET['isbn'];
45ae2aeb2b52 original
robert
parents:
diff changeset
29 if(isset($_GET['locale'])){
45ae2aeb2b52 original
robert
parents:
diff changeset
30 $locale=$_GET['locale'];
45ae2aeb2b52 original
robert
parents:
diff changeset
31
45ae2aeb2b52 original
robert
parents:
diff changeset
32 switch ($locale) {
45ae2aeb2b52 original
robert
parents:
diff changeset
33 case "uk":
45ae2aeb2b52 original
robert
parents:
diff changeset
34 $loc = 1;
45ae2aeb2b52 original
robert
parents:
diff changeset
35 break;
45ae2aeb2b52 original
robert
parents:
diff changeset
36 case "us":
45ae2aeb2b52 original
robert
parents:
diff changeset
37 $loc = 0;
45ae2aeb2b52 original
robert
parents:
diff changeset
38 break;
45ae2aeb2b52 original
robert
parents:
diff changeset
39 case "ca":
45ae2aeb2b52 original
robert
parents:
diff changeset
40 $loc = 2;
45ae2aeb2b52 original
robert
parents:
diff changeset
41 break;
45ae2aeb2b52 original
robert
parents:
diff changeset
42 case "de":
45ae2aeb2b52 original
robert
parents:
diff changeset
43 $loc = 3;
45ae2aeb2b52 original
robert
parents:
diff changeset
44 break;
45ae2aeb2b52 original
robert
parents:
diff changeset
45 case "fr":
45ae2aeb2b52 original
robert
parents:
diff changeset
46 $loc = 4;
45ae2aeb2b52 original
robert
parents:
diff changeset
47 break;
45ae2aeb2b52 original
robert
parents:
diff changeset
48 case "":
45ae2aeb2b52 original
robert
parents:
diff changeset
49 $loc = 0;
45ae2aeb2b52 original
robert
parents:
diff changeset
50 break;
45ae2aeb2b52 original
robert
parents:
diff changeset
51 }
45ae2aeb2b52 original
robert
parents:
diff changeset
52 }
45ae2aeb2b52 original
robert
parents:
diff changeset
53 else{
45ae2aeb2b52 original
robert
parents:
diff changeset
54 $loc=0;
45ae2aeb2b52 original
robert
parents:
diff changeset
55 }
45ae2aeb2b52 original
robert
parents:
diff changeset
56 $output = "";
45ae2aeb2b52 original
robert
parents:
diff changeset
57
45ae2aeb2b52 original
robert
parents:
diff changeset
58 $output .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
45ae2aeb2b52 original
robert
parents:
diff changeset
59 $output .= "<BookDetails>";
45ae2aeb2b52 original
robert
parents:
diff changeset
60
45ae2aeb2b52 original
robert
parents:
diff changeset
61 $proceed = true;
45ae2aeb2b52 original
robert
parents:
diff changeset
62 include "../../../private/db.php";
45ae2aeb2b52 original
robert
parents:
diff changeset
63
45ae2aeb2b52 original
robert
parents:
diff changeset
64 $query = "CALL b_getBookInfo('$isbn', $loc)";
45ae2aeb2b52 original
robert
parents:
diff changeset
65 //select Timestamp,Title,Author,Binding,DeweyDecimal,ImageURL,SalesRank,PublicationDate,Publisher,Genre1,Genre2,Genre3 from books where ISBN = '$isbn'";
45ae2aeb2b52 original
robert
parents:
diff changeset
66 //echo $query;
45ae2aeb2b52 original
robert
parents:
diff changeset
67 $res = mysqli_query($link, $query) or exit( mysqli_error( $link ));
45ae2aeb2b52 original
robert
parents:
diff changeset
68
45ae2aeb2b52 original
robert
parents:
diff changeset
69 if ( mysqli_num_rows( $res ) > 0 )
45ae2aeb2b52 original
robert
parents:
diff changeset
70 {
45ae2aeb2b52 original
robert
parents:
diff changeset
71 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC);
45ae2aeb2b52 original
robert
parents:
diff changeset
72 $timestamp=$rows['Timestamp'];
45ae2aeb2b52 original
robert
parents:
diff changeset
73 //echo $timestamp;
45ae2aeb2b52 original
robert
parents:
diff changeset
74 date_default_timezone_set('UTC');
45ae2aeb2b52 original
robert
parents:
diff changeset
75 $dbStamp = strtotime($timestamp);
45ae2aeb2b52 original
robert
parents:
diff changeset
76 //echo $dbStamp;
45ae2aeb2b52 original
robert
parents:
diff changeset
77 $unixTime = time();
45ae2aeb2b52 original
robert
parents:
diff changeset
78 //echo $unixTime;
45ae2aeb2b52 original
robert
parents:
diff changeset
79 $timeDiff = $unixTime - $dbStamp;
45ae2aeb2b52 original
robert
parents:
diff changeset
80 //echo $timeDiff;
45ae2aeb2b52 original
robert
parents:
diff changeset
81
45ae2aeb2b52 original
robert
parents:
diff changeset
82 if($timeDiff < 2592000) //if it has been updated in the last 30 days
45ae2aeb2b52 original
robert
parents:
diff changeset
83 {
45ae2aeb2b52 original
robert
parents:
diff changeset
84 $proceed = false;
45ae2aeb2b52 original
robert
parents:
diff changeset
85 $output .= "<ISBN>" . $isbn . "</ISBN>";
45ae2aeb2b52 original
robert
parents:
diff changeset
86 $output .= "<Title>" . htmlspecialchars($rows["Title"]) . "</Title>";
45ae2aeb2b52 original
robert
parents:
diff changeset
87 $output .= "<Author>" . htmlspecialchars($rows["Author"]) . "</Author>";
45ae2aeb2b52 original
robert
parents:
diff changeset
88 $output .= "<Binding>" . htmlspecialchars($rows["Binding"]) . "</Binding>";
45ae2aeb2b52 original
robert
parents:
diff changeset
89 $output .= "<Dewey>" . htmlspecialchars($rows["DeweyDecimal"]) . "</Dewey>";
45ae2aeb2b52 original
robert
parents:
diff changeset
90 $output .= "<ImageURL>" . htmlspecialchars($rows["ImageURL"]) . "</ImageURL>";
45ae2aeb2b52 original
robert
parents:
diff changeset
91 $output .= "<SalesRank>" . htmlspecialchars($rows["SalesRank"]) . "</SalesRank>";
45ae2aeb2b52 original
robert
parents:
diff changeset
92 $output .= "<PublicationDate>" . htmlspecialchars($rows["PublicationDate"]) . "</PublicationDate>";
45ae2aeb2b52 original
robert
parents:
diff changeset
93 $output .= "<Publisher>" . htmlspecialchars($rows["Publisher"]) . "</Publisher>";
45ae2aeb2b52 original
robert
parents:
diff changeset
94 $output .= "<Genre1>" . htmlspecialchars($rows["Genre1"]) . "</Genre1>";
45ae2aeb2b52 original
robert
parents:
diff changeset
95 $output .= "<Genre2>" . htmlspecialchars($rows["Genre2"]) . "</Genre2>";
45ae2aeb2b52 original
robert
parents:
diff changeset
96 $output .= "<Genre3>" . htmlspecialchars($rows["Genre3"]) . "</Genre3>";
45ae2aeb2b52 original
robert
parents:
diff changeset
97 $output .= "<ProductGroup>Book</ProductGroup>";
45ae2aeb2b52 original
robert
parents:
diff changeset
98 }
45ae2aeb2b52 original
robert
parents:
diff changeset
99 }
45ae2aeb2b52 original
robert
parents:
diff changeset
100 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
45ae2aeb2b52 original
robert
parents:
diff changeset
101 include "../../../private/db.php";
45ae2aeb2b52 original
robert
parents:
diff changeset
102
45ae2aeb2b52 original
robert
parents:
diff changeset
103 if($proceed == true)
45ae2aeb2b52 original
robert
parents:
diff changeset
104 {
45ae2aeb2b52 original
robert
parents:
diff changeset
105 include "aws_signed_request.php";
45ae2aeb2b52 original
robert
parents:
diff changeset
106 //book does not exist already so look up all the info from browse nodes....
45ae2aeb2b52 original
robert
parents:
diff changeset
107
45ae2aeb2b52 original
robert
parents:
diff changeset
108 $Adefault=array(
45ae2aeb2b52 original
robert
parents:
diff changeset
109 'language' =>'en', //what language to render the page in
45ae2aeb2b52 original
robert
parents:
diff changeset
110 'locale' =>'us', //which server's products? available: ca,de,fr,jp,uk,us
45ae2aeb2b52 original
robert
parents:
diff changeset
111 'page' =>1, //first page to show (we are counting from 1 not 0)
45ae2aeb2b52 original
robert
parents:
diff changeset
112 'operation' =>'ItemLookup', //what to do? //ItemSearch
45ae2aeb2b52 original
robert
parents:
diff changeset
113 'searchparameter' =>'ItemId', //what kind of search?
45ae2aeb2b52 original
robert
parents:
diff changeset
114 'searchindex' => 'Books',
45ae2aeb2b52 original
robert
parents:
diff changeset
115 'searchparameterdata'=>$isbn, //what to search for?
45ae2aeb2b52 original
robert
parents:
diff changeset
116 'search' =>$isbn,
45ae2aeb2b52 original
robert
parents:
diff changeset
117 //here some debugging flags you can put at the end of the URL to call this script with, like: '?show_array=true'
45ae2aeb2b52 original
robert
parents:
diff changeset
118 'show_array' =>false, //debug: show complete incoming array? You can use this to see what other information Amazon is sending
45ae2aeb2b52 original
robert
parents:
diff changeset
119 'show_url' =>false, //debug: show XML request url to be send to Amazon?
45ae2aeb2b52 original
robert
parents:
diff changeset
120 'show_xml' =>false, //debug: show incoming XML code from Amazon?
45ae2aeb2b52 original
robert
parents:
diff changeset
121 );
45ae2aeb2b52 original
robert
parents:
diff changeset
122 //change the debug options to true if you want to activate them or call the script with '?show_array=true' to see what actual information you're getting from Amazon and how little my standard script is actually showing of it
45ae2aeb2b52 original
robert
parents:
diff changeset
123
45ae2aeb2b52 original
robert
parents:
diff changeset
124 $Aassociates_id=array(
45ae2aeb2b52 original
robert
parents:
diff changeset
125 'uk' => 'bookwhack-21',
45ae2aeb2b52 original
robert
parents:
diff changeset
126 'us' => 'your02b-20',
45ae2aeb2b52 original
robert
parents:
diff changeset
127 'ca' => 'book009-20',
45ae2aeb2b52 original
robert
parents:
diff changeset
128 'de' => 'book04c-21',
45ae2aeb2b52 original
robert
parents:
diff changeset
129 'fr' => 'book07f-21',
45ae2aeb2b52 original
robert
parents:
diff changeset
130 );
45ae2aeb2b52 original
robert
parents:
diff changeset
131
45ae2aeb2b52 original
robert
parents:
diff changeset
132 $Aserver=array(
45ae2aeb2b52 original
robert
parents:
diff changeset
133 'ca' => array(
45ae2aeb2b52 original
robert
parents:
diff changeset
134 'ext' => 'ca' , //Canadian normal server
45ae2aeb2b52 original
robert
parents:
diff changeset
135 'nor' => 'http://www.amazon.ca' , //Canadian normal server
45ae2aeb2b52 original
robert
parents:
diff changeset
136 'xml' => 'http://xml.amazon.com' , //Canadian xml server
45ae2aeb2b52 original
robert
parents:
diff changeset
137 ),
45ae2aeb2b52 original
robert
parents:
diff changeset
138 'de' => array(
45ae2aeb2b52 original
robert
parents:
diff changeset
139 'ext' => 'de' , //German normal server
45ae2aeb2b52 original
robert
parents:
diff changeset
140 'nor' => 'http://www.amazon.de' , //German normal server
45ae2aeb2b52 original
robert
parents:
diff changeset
141 'xml' => 'http://xml-eu.amazon.com', //German xml server
45ae2aeb2b52 original
robert
parents:
diff changeset
142 ),
45ae2aeb2b52 original
robert
parents:
diff changeset
143 'fr' => array(
45ae2aeb2b52 original
robert
parents:
diff changeset
144 'ext' => 'fr' , //French normal server
45ae2aeb2b52 original
robert
parents:
diff changeset
145 'nor' => 'http://www.amazon.fr' , //French normal server
45ae2aeb2b52 original
robert
parents:
diff changeset
146 'xml' => 'http://xml-eu.amazon.com', //French xml server
45ae2aeb2b52 original
robert
parents:
diff changeset
147 ),
45ae2aeb2b52 original
robert
parents:
diff changeset
148 'jp' => array(
45ae2aeb2b52 original
robert
parents:
diff changeset
149 'ext' => 'jp' , //Japanese normal server, not co.jp!
45ae2aeb2b52 original
robert
parents:
diff changeset
150 'nor' => 'http://www.amazon.co.jp' , //Japanese normal server
45ae2aeb2b52 original
robert
parents:
diff changeset
151 'xml' => 'http://xml.amazon.com' , //Japanese xml server
45ae2aeb2b52 original
robert
parents:
diff changeset
152 ),
45ae2aeb2b52 original
robert
parents:
diff changeset
153 'uk' => array(
45ae2aeb2b52 original
robert
parents:
diff changeset
154 'ext' => 'co.uk' , //UK normal server
45ae2aeb2b52 original
robert
parents:
diff changeset
155 'nor' => 'http://www.amazon.co.uk' , //UK normal server
45ae2aeb2b52 original
robert
parents:
diff changeset
156 'xml' => 'http://xml-eu.amazon.com', //UK xml server
45ae2aeb2b52 original
robert
parents:
diff changeset
157 ),
45ae2aeb2b52 original
robert
parents:
diff changeset
158 'us' => array(
45ae2aeb2b52 original
robert
parents:
diff changeset
159 'ext' => 'com' , //USA normal server
45ae2aeb2b52 original
robert
parents:
diff changeset
160 'nor' => 'http://www.amazon.com' , //USA normal server
45ae2aeb2b52 original
robert
parents:
diff changeset
161 'xml' => 'http://xml.amazon.com' , //USA xml server
45ae2aeb2b52 original
robert
parents:
diff changeset
162 ),
45ae2aeb2b52 original
robert
parents:
diff changeset
163 );
17
ae1459564f66 Replace old associate keys with new IAMs user keys
Robert Boland <robert@markup.co.uk>
parents: 10
diff changeset
164 $public_key ="AKIAIHTNWC7L6LOUY4LQ";
ae1459564f66 Replace old associate keys with new IAMs user keys
Robert Boland <robert@markup.co.uk>
parents: 10
diff changeset
165 $private_key="zWQlIzndJDtXNfxEXH7K7YR7hzv3u77lOcqfqPde";
2
45ae2aeb2b52 original
robert
parents:
diff changeset
166
45ae2aeb2b52 original
robert
parents:
diff changeset
167 //for all parameters see if the user has overruled it or use the default
45ae2aeb2b52 original
robert
parents:
diff changeset
168 foreach ($Adefault as $i=>$d) {
45ae2aeb2b52 original
robert
parents:
diff changeset
169 $$i=isset($_GET[$i])?$_GET[$i]:$d;
45ae2aeb2b52 original
robert
parents:
diff changeset
170 }
45ae2aeb2b52 original
robert
parents:
diff changeset
171
45ae2aeb2b52 original
robert
parents:
diff changeset
172 $parameters=array(
45ae2aeb2b52 original
robert
parents:
diff changeset
173 'Operation' =>$operation ,
45ae2aeb2b52 original
robert
parents:
diff changeset
174 'Keywords' =>urlencode($search) ,
45ae2aeb2b52 original
robert
parents:
diff changeset
175 "$searchparameter"=>$searchparameterdata ,
45ae2aeb2b52 original
robert
parents:
diff changeset
176 'ItemPage' =>$page , //which page?
45ae2aeb2b52 original
robert
parents:
diff changeset
177 'AssociateTag' =>$Aassociates_id[$locale],
45ae2aeb2b52 original
robert
parents:
diff changeset
178 'ResponseGroup' =>'ItemAttributes,Images,SalesRank,BrowseNodes'
45ae2aeb2b52 original
robert
parents:
diff changeset
179 );
45ae2aeb2b52 original
robert
parents:
diff changeset
180
3
a5e5475bf357 fix ASIN pblm, add debugging
robert
parents: 2
diff changeset
181 if ($searchindex!='Books') {
a5e5475bf357 fix ASIN pblm, add debugging
robert
parents: 2
diff changeset
182 // HST did this
a5e5475bf357 fix ASIN pblm, add debugging
robert
parents: 2
diff changeset
183 // Used to be in $parameters init above, but
a5e5475bf357 fix ASIN pblm, add debugging
robert
parents: 2
diff changeset
184 // that caused an error:
a5e5475bf357 fix ASIN pblm, add debugging
robert
parents: 2
diff changeset
185 // If idType equals ASIN, SearchIndex cannot be present
a5e5475bf357 fix ASIN pblm, add debugging
robert
parents: 2
diff changeset
186 //'SearchIndex' =>$searchindex , //Books for example.
a5e5475bf357 fix ASIN pblm, add debugging
robert
parents: 2
diff changeset
187 $parameters['SearchIndex']=$searchindex;
a5e5475bf357 fix ASIN pblm, add debugging
robert
parents: 2
diff changeset
188 }
a5e5475bf357 fix ASIN pblm, add debugging
robert
parents: 2
diff changeset
189
a5e5475bf357 fix ASIN pblm, add debugging
robert
parents: 2
diff changeset
190
2
45ae2aeb2b52 original
robert
parents:
diff changeset
191 $ext=$Aserver[$locale]['ext'];
45ae2aeb2b52 original
robert
parents:
diff changeset
192 $file_data=$ext;
45ae2aeb2b52 original
robert
parents:
diff changeset
193 ksort($parameters);
45ae2aeb2b52 original
robert
parents:
diff changeset
194 foreach ($parameters as $i=>$d) {
45ae2aeb2b52 original
robert
parents:
diff changeset
195 $file_data.='&'.$i.'='.$d;
45ae2aeb2b52 original
robert
parents:
diff changeset
196 }
45ae2aeb2b52 original
robert
parents:
diff changeset
197
45ae2aeb2b52 original
robert
parents:
diff changeset
198 $url=aws_signed_request($ext,$parameters,$public_key,$private_key);
45ae2aeb2b52 original
robert
parents:
diff changeset
199 //echo $url;
45ae2aeb2b52 original
robert
parents:
diff changeset
200
45ae2aeb2b52 original
robert
parents:
diff changeset
201 $crl = curl_init();
45ae2aeb2b52 original
robert
parents:
diff changeset
202 $timeout = 5;
45ae2aeb2b52 original
robert
parents:
diff changeset
203 curl_setopt ($crl, CURLOPT_URL,$url);
45ae2aeb2b52 original
robert
parents:
diff changeset
204 curl_setopt ($crl, CURLOPT_ENCODING , "gzip");
45ae2aeb2b52 original
robert
parents:
diff changeset
205 curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
45ae2aeb2b52 original
robert
parents:
diff changeset
206 curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
21
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
207 $gotit=0;
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
208 $requestIP = $_SERVER['REMOTE_ADDR'];
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
209 $semaphore = new SyncSemaphore("Amazon");
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
210 $gotit = $semaphore->lock(4000);
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
211 if (!$gotit) {
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
212 file_put_contents('/var/ywww/debug/phpDebug',
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
213 "Got it: ".(int)$gotit." $requestIP 2\n",FILE_APPEND);
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
214 $gotit=$semaphore->lock(5000);
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
215 file_put_contents('/var/ywww/debug/phpDebug',
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
216 "Got it: ".(int)$gotit." $requestIP 2a\n",FILE_APPEND);
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
217 }
2
45ae2aeb2b52 original
robert
parents:
diff changeset
218 $out = curl_exec($crl);
45ae2aeb2b52 original
robert
parents:
diff changeset
219 curl_close($crl);
21
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
220 usleep(1000000);
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
221 if ($gotit) {
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
222 $semaphore->unlock();
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
223 }
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
224 else {
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
225 file_put_contents('/var/ywww/debug/phpDebug',
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
226 "W/o lock for $requestIP 2b\n",FILE_APPEND);
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
227 }
2
45ae2aeb2b52 original
robert
parents:
diff changeset
228 //echo $out;
45ae2aeb2b52 original
robert
parents:
diff changeset
229
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
230 if (preg_match("<Error>",$out)) {
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
231 $xml = new SimpleXMLElement($out);
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
232 $resName=$xml->getName();
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
233 $code=$xml->Error->Code;
21
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
234 $requestIP = $_SERVER['REMOTE_ADDR'];
46382face560 use a semaphore to try to cut down on RequestThrottled fails
Charlie Root
parents: 18
diff changeset
235 file_put_contents('/var/ywww/debug/phpDebug',"Losing gBD: $resName, $code, $requestIP\n",FILE_APPEND);
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
236 if ($code=='RequestThrottled') {
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
237 usleep(200000); // Try to reduce throttling until we get a
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
238 // principled solution in place
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
239 }
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
240 else {
18
c41a5802b26c better debugging
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 17
diff changeset
241 file_put_contents('/var/ywww/debug/phpDebug',"parms $url\nbd: ".
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
242 print_r($parameters,TRUE)."\n",FILE_APPEND);
10
5aa24c984a3b if no code show entire response
Henry S. Thompson <ht@markup.co.uk>
parents: 9
diff changeset
243 if ($code=="") {
5aa24c984a3b if no code show entire response
Henry S. Thompson <ht@markup.co.uk>
parents: 9
diff changeset
244 file_put_contents('/var/ywww/debug/phpDebug',"error elt:\n$out\n",FILE_APPEND);
5aa24c984a3b if no code show entire response
Henry S. Thompson <ht@markup.co.uk>
parents: 9
diff changeset
245 }
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
246 }
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
247 }
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
248 else {
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
249 $xml = new SimpleXMLElement($out);
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
250 //use this xml to pull out the necessary information and save it
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
251 set_error_handler(function () {
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
252 global $out,$isbn;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
253 file_put_contents('/var/ywww/debug/phpDebug',
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
254 "Caught one bd: ".$isbn,
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
255 FILE_APPEND);
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
256 file_put_contents('/var/ywww/debug/phpDebug',
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
257 print_r($out, TRUE)."\n",
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
258 FILE_APPEND);
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
259 } );
2
45ae2aeb2b52 original
robert
parents:
diff changeset
260
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
261 $title="";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
262 $author="";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
263 $binding="";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
264 $dewey="";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
265 $imageURL="";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
266 $salesRank="";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
267 $pubDate="";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
268 $publisher="";
2
45ae2aeb2b52 original
robert
parents:
diff changeset
269
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
270 $title = $xml->Items->Item->ItemAttributes->Title;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
271 $author = $xml->Items->Item->ItemAttributes->Author;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
272 $binding = $xml->Items->Item->ItemAttributes->Binding;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
273 $dewey = $xml->Items->Item->ItemAttributes->DeweyDecimalNumber;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
274 if($dewey == "")
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
275 $dewey = "null";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
276 $imageURL = $xml->Items->Item->MediumImage->URL;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
277 $salesRank = $xml->Items->Item->SalesRank;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
278 $pubDate = $xml->Items->Item->ItemAttributes->PublicationDate;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
279 $publisher = $xml->Items->Item->ItemAttributes->Publisher;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
280 restore_error_handler();
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
281 /*echo $title;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
282 echo $author;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
283 echo $binding;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
284 echo $dewey;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
285 echo $imageURL;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
286 echo $salesRank;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
287 echo $pubDate;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
288 echo $publisher;*/
2
45ae2aeb2b52 original
robert
parents:
diff changeset
289
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
290 $genreID = "";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
291 $genre = "";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
292 $genArr = array();
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
293 $g1 = "null";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
294 $g2 = "null";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
295 $g3 = "null";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
296 if(isset($xml->Items->Item->BrowseNodes->BrowseNode)){
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
297 for($i=0;$i<sizeof($xml->Items->Item->BrowseNodes->BrowseNode);$i++){
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
298 //sexy recursive function
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
299 findGenre($xml->Items->Item->BrowseNodes->BrowseNode[$i], $genreID, $genre);
2
45ae2aeb2b52 original
robert
parents:
diff changeset
300
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
301 if($genre != "")
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
302 $genArr[strval($genreID)] = strval($genre);
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
303 //$genArr[$i] = array(strval($genreID) => strval($genre));
2
45ae2aeb2b52 original
robert
parents:
diff changeset
304
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
305 //echo $genre;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
306 //echo $genreID;
2
45ae2aeb2b52 original
robert
parents:
diff changeset
307
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
308 $genre = "";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
309 $genreID = "";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
310 }
2
45ae2aeb2b52 original
robert
parents:
diff changeset
311
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
312 $g1 = "null";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
313 $g2 = "null";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
314 $g3 = "null";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
315 $loop = 1;
2
45ae2aeb2b52 original
robert
parents:
diff changeset
316
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
317 foreach ($genArr as $key => $value) {
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
318 //echo "$key => $value";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
319 $queryG = "CALL b_addBrowseNode($key,\"$value\")"; //add the name value pair for genre to new table
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
320 //echo $queryG;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
321 $resG = mysqli_query($link, $queryG);
2
45ae2aeb2b52 original
robert
parents:
diff changeset
322
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
323 switch ($loop) {
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
324 case 1:
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
325 $g1 = $key;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
326 break;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
327 case 2:
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
328 $g2 = $key;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
329 break;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
330 case 3:
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
331 $g3 = $key;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
332 break;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
333 }
2
45ae2aeb2b52 original
robert
parents:
diff changeset
334
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
335 $loop++;
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
336 }
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
337 }
2
45ae2aeb2b52 original
robert
parents:
diff changeset
338
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
339 if($salesRank == "")
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
340 $salesRank = "null";
2
45ae2aeb2b52 original
robert
parents:
diff changeset
341
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
342 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
343 include "../../../private/db.php";
2
45ae2aeb2b52 original
robert
parents:
diff changeset
344
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
345 $title = strtr($title, '"', "'");
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
346 $queryInsert = "CALL b_addNewBook(\"$isbn\",\"$title\", \"$author\",\"$binding\",\"$imageURL\", $dewey, $salesRank,\"$pubDate\",\"$publisher\",$g1,$g2,$g3,$loc)";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
347 //echo $queryInsert;
2
45ae2aeb2b52 original
robert
parents:
diff changeset
348
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
349 $resG = mysqli_query($link, $queryInsert) or exit( mysqli_error( $link ));
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
350 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
2
45ae2aeb2b52 original
robert
parents:
diff changeset
351
45ae2aeb2b52 original
robert
parents:
diff changeset
352
9
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
353 $output .= "<ISBN>" . htmlspecialchars($isbn) . "</ISBN>";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
354 $output .= "<Title>" . htmlspecialchars($title) . "</Title>";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
355 $output .= "<Author>" . htmlspecialchars($author) . "</Author>";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
356 $output .= "<Binding>" . htmlspecialchars($binding) . "</Binding>";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
357 $output .= "<Dewey>" . htmlspecialchars($dewey) . "</Dewey>";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
358 $output .= "<ImageURL>" . htmlspecialchars($imageURL) . "</ImageURL>";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
359 $output .= "<SalesRank>" . htmlspecialchars($salesRank) . "</SalesRank>";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
360 $output .= "<PublicationDate>" . htmlspecialchars($pubDate) . "</PublicationDate>";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
361 $output .= "<Publisher>" . htmlspecialchars($publisher) . "</Publisher>";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
362 $output .= "<Genre1>" . htmlspecialchars($g1) . "</Genre1>";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
363 $output .= "<Genre2>" . htmlspecialchars($g2) . "</Genre2>";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
364 $output .= "<Genre3>" . htmlspecialchars($g3) . "</Genre3>";
232deb0b066a tidy up debugging, only show parms on non-throttled error
Henry S. Thompson <ht@markup.co.uk>
parents: 6
diff changeset
365 $output .= "<ProductGroup>Book</ProductGroup>";
6
077b0a0a3e6d remaining originals according to dependency walk
Robert Boland <robert@markup.co.uk>
parents: 3
diff changeset
366 }
2
45ae2aeb2b52 original
robert
parents:
diff changeset
367 }
45ae2aeb2b52 original
robert
parents:
diff changeset
368
45ae2aeb2b52 original
robert
parents:
diff changeset
369 $output .= "</BookDetails>";
45ae2aeb2b52 original
robert
parents:
diff changeset
370
45ae2aeb2b52 original
robert
parents:
diff changeset
371 echo $output;
45ae2aeb2b52 original
robert
parents:
diff changeset
372 }
45ae2aeb2b52 original
robert
parents:
diff changeset
373 ?>