annotate xml/getAmazonInfo.php @ 42:3f400072bf14

merge, involved ediff3 wrt getAmazonInfo.php
author Charlie Root
date Sat, 05 Jan 2019 06:21:12 -0500
parents 0578c6e438d3 2c0c95bd97a6
children dbc006408d2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
1 <?php
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
2
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
3 include_once "doAmazonRequest.inc";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
4
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
5 function getAmazonDet($isbn,$go,$localeIn)
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
6 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
7 $Adefault=array(
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
8 'language' =>'en', //what language to render the page in
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
9 'locale' =>$localeIn, //which server's products? available: ca,de,fr,jp,uk,us
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
10 //'mode' =>'books', //what product category?
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
11 'page' =>1, //first page to show (we are counting from 1 not 0)
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
12 //'search' =>'Machiavelli', //what to search for?
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
13 'operation' =>'ItemLookup', //what to do? //ItemSearch
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
14 'searchindex' =>'Books', //what product category for search?
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
15 'searchparameter' =>'ItemId', //what kind of search?
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
16 'searchparameterdata'=>$isbn, //what to search for?
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
17 //here some debugging flags you can put at the end of the URL to call this script with, like: '?show_array=true'
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
18 'show_array' =>false, //debug: show complete incoming array? You can use this to see what other information Amazon is sending
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
19 'show_url' =>false, //debug: show XML request url to be send to Amazon?
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
20 'show_xml' =>false, //debug: show incoming XML code from Amazon?
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
21 );
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
22 //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
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
23 //for all parameters see if the user has overruled it or use the default
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
24 foreach ($Adefault as $i=>$d) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
25 $$i=isset($_GET[$i])?$_GET[$i]:$d;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
26 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
27 switch($locale){
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
28 case "us":
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
29 $loc = 0;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
30 break;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
31 case "uk":
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
32 $loc = 1;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
33 break;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
34 case "ca":
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
35 $loc = 2;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
36 break;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
37 case "de":
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
38 $loc = 3;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
39 break;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
40 case "fr":
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
41 $loc = 4;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
42 break;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
43 };
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
44
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
45 try {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
46 return getAmazonDetRemote($go,$language,$locale,$loc,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
47 $page,$operation,$searchparameter,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
48 $searchparameterdata,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
49 $show_array,$show_url,$show_xml);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
50 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
51 catch (Exception $e) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
52 return getAmazonDetLocal($go,$language,$loc,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
53 $page,$operation,$searchparameter,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
54 $searchparameterdata,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
55 $show_array,$show_url,$show_xml);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
56 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
57 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
58
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
59 function getAmazonDetRemote($go,$language,$locale,$loc,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
60 $page,$operation,$searchparameter,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
61 $searchparameterdata,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
62 $show_array,$show_url,$show_xml)
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
63 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
64 global $output, $Aassociates_id, $Aserver;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
65
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
66 //if(go != 1)
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
67 //include "aws_signed_request.php";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
68 //this is the data that is used to form the request for AWS
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
69 //this is the part that is search specific
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
70 $parameters=array(
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
71 'Operation' =>$operation ,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
72 //'Keywords' =>urlencode($search) ,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
73 "$searchparameter"=>$searchparameterdata ,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
74 'ItemPage' =>$page , //which page?
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
75 'AssociateTag' =>$Aassociates_id[$locale],
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
76 'ResponseGroup' =>'ItemAttributes,Reviews,EditorialReview,OfferSummary,Offers,Images,AlternateVersions,SalesRank,BrowseNodes' , //Small, Medium, Large or SellerListing,'BrowseNodes',// ,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
77 'ReviewSort' =>'-HelpfulVotes'
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
78 );
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
79
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
80 if (isset($searchindex) && $searchindex!='Books') {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
81 // HST did this
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
82 // Used to be in $parameters init above, but
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
83 // that caused an error:
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
84 // If idType equals ASIN, SearchIndex cannot be present
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
85 //'SearchIndex' =>$searchindex , //Books for example.
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
86 $parameters['SearchIndex']=$searchindex;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
87 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
88 $xml=doAmazonRequest($Aserver[$locale]['ext'],$parameters,3,'i'); // may throw exception
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
89 set_error_handler(function () {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
90 global $output;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
91 file_put_contents('/var/ywww/debug/phpDebug',
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
92 "Caught one?: ".$searchparameterdata,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
93 FILE_APPEND);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
94 file_put_contents('/var/ywww/debug/phpDebug',
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
95 print_r($output, TRUE)."\n",
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
96 FILE_APPEND);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
97 } );
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
98 $review = $xml->Items->Item->CustomerReviews->IFrameURL;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
99 restore_error_handler();
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
100 //echo $review;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
101 if ($review != "")
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
102 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
103 $review1 = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
104 $review2 = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
105 $review3 = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
106 $text = @file_get_contents($review . "&truncate=300");
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
107 $removeTop1 = preg_replace('~<div class="crIFrameHeaderLeftColumn">(.*?)<div class="crIFrameHeaderHistogram">~si', '', $text);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
108 $removeTop2 = preg_replace('~<div class="crIFrameHeaderHistogram">(.*?)<div class="crIframeReviewList">~si', '', $text);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
109 if (preg_match('~<body[^>]*>(.*?)</body>~si', $removeTop2, $body)){ $getBody = trim($body[1]); } else { $getBody = $removeTop2;}
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
110 $removeDiv = preg_replace('~<div[^>]*>(.*?)</div>~si', '', $getBody);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
111 $removeCloseDivs = preg_replace('/<\/div>/','', $removeDiv);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
112 $setBoundary = str_replace('<!-- BOUNDARY -->','BOTTOM-TOP', $removeCloseDivs);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
113 //replace <!-- BOUNDARY --> with BOTTOM-TOP
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
114 $remove1 = '~<table cellpadding="0"(.*?)%">~s';
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
115 $setBoundary = preg_replace($remove1,'', $setBoundary);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
116 $remove2 = '~</td><td bg(.*?)</table>~s';
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
117 $setBoundary = preg_replace($remove2,'', $setBoundary);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
118 $remove3 = '~<a name=(.*?)</a>~s';
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
119 $setBoundary = preg_replace($remove3,'', $setBoundary);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
120 $setBoundary2 = str_replace('<br />','', $setBoundary);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
121 //remove all extra crap;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
122 $setBoundary3 = str_replace('</td>','BOTTOM', $setBoundary2);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
123 //replace </td> with BOTTOM
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
124
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
125 if (preg_match_all('~TOP(.*?)BOTTOM~s', $setBoundary3, $reviews))
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
126 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
127 $reviewContents = $reviews[1];
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
128 //print_r($reviewContents);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
129 $review1 = trim($reviewContents[0]);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
130 $review1 = str_replace("\n", "", $review1);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
131 $review1 = str_replace("\r", "", $review1);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
132 if (isset($reviewContents[1])) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
133 $review2 = trim($reviewContents[1]);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
134 $review2 = str_replace("\n", "", $review2);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
135 $review2 = str_replace("\r", "", $review2);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
136 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
137 else {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
138 $review2 = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
139 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
140 if (isset($reviewContents[2])) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
141 $review3 = trim($reviewContents[2]);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
142 $review3 = str_replace("\n", "", $review3);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
143 $review3 = str_replace("\r", "", $review3);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
144 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
145 else {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
146 $review3 = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
147 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
148 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
149 else
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
150 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
151 $review1 = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
152 $review2 = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
153 $review3 = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
154 //echo "EPIC FAIL";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
155 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
156
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
157 unset($xml->Items->Item->CustomerReviews);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
158 $xdoc = new DomDocument;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
159 $xdoc->loadXML($xml->asXML());
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
160
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
161 $cReviews = $xdoc ->createElement('CustomerReviews');
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
162 $cReviewHolder = $xdoc ->createElement('Review');
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
163 $cReview = $xdoc ->createElement('Content');
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
164 $cReviewHolder2 = $xdoc ->createElement('Review');
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
165 $cReview2 = $xdoc ->createElement('Content');
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
166 $cReviewHolder3 = $xdoc ->createElement('Review');
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
167 $cReview3 = $xdoc ->createElement('Content');
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
168
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
169 $txtNode = $xdoc ->createTextNode ($review1);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
170 $cReview -> appendChild($txtNode);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
171
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
172 $txtNode2 = $xdoc ->createTextNode ($review2);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
173 $cReview2 -> appendChild($txtNode2);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
174
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
175 $txtNode3 = $xdoc ->createTextNode ($review3);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
176 $cReview3 -> appendChild($txtNode3);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
177
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
178 $cReviewHolder -> appendChild($cReview);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
179 $cReviewHolder2 -> appendChild($cReview2);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
180 $cReviewHolder3 -> appendChild($cReview3);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
181
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
182 $cReviews -> appendChild($cReviewHolder);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
183 $cReviews -> appendChild($cReviewHolder2);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
184 $cReviews -> appendChild($cReviewHolder3);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
185
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
186 $xdoc->documentElement->childNodes->item(1)->childNodes->item(1)->appendChild($cReviews);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
187 $newXML = simplexml_import_dom($xdoc);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
188 $output = $newXML->asXml();
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
189 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
190
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
191 if($go == 1) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
192 $item = $xml->Items->Item[0];
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
193 if ($item && $item->ItemAttributes && $item->ItemAttributes->Title) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
194 $title = $item->ItemAttributes->Title; }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
195 else { $title = "[no title]"; };
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
196 file_put_contents('/var/ywww/debug/phpDebug',"win: $title\n",
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
197 FILE_APPEND);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
198 return $output;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
199 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
200 else {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
201 if ($xml->Items->Item) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
202 $title = $xml->Items->Item[0]->ItemAttributes->Title;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
203 $author = $xml->Items->Item[0]->ItemAttributes->Author;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
204 $binding = $xml->Items->Item[0]->ItemAttributes->Binding;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
205 $dewey = $xml->Items->Item[0]->ItemAttributes->DeweyDecimalNumber;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
206 if($dewey == "")
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
207 $dewey = "null";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
208 $imageURL = $xml->Items->Item[0]->MediumImage->URL;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
209 $salesRank = $xml->Items->Item[0]->SalesRank;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
210 $pubDate = $xml->Items->Item[0]->ItemAttributes->PublicationDate;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
211 if (strlen($pubDate)==4) { $pubDate=$pubDate."-01-01";}
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
212 if (strlen($pubDate)==7) { $pubDate=$pubDate."-01";}
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
213 if (strlen($pubDate)==0) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
214 $pubDate="null";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
215 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
216 else {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
217 $pubDate="\"$pubDate\"";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
218 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
219 $publisher = $xml->Items->Item[0]->ItemAttributes->Publisher;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
220 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
221 else {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
222 $title = $salesRank = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
223 $dewey = "null";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
224 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
225
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
226 $genreID = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
227 $genre = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
228 $genArr = array();
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
229
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
230 if ($xml->Items->Item[0] && $xml->Items->Item[0]->BrowseNodes) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
231 for($i=0;$i<sizeof($xml->Items->Item->BrowseNodes->BrowseNode);$i++){
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
232 //sexy recursive function
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
233 findGenre($xml->Items->Item->BrowseNodes->BrowseNode[$i], $genreID, $genre);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
234
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
235 if($genre != "")
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
236 $genArr[strval($genreID)] = strval($genre);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
237 //$genArr[$i] = array(strval($genreID) => strval($genre));
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
238
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
239 //echo $genre;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
240 //echo $genreID;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
241
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
242 $genre = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
243 $genreID = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
244 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
245 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
246
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
247 $g1 = "null";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
248 $g2 = "null";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
249 $g3 = "null";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
250 $loop = 1;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
251
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
252 foreach ($genArr as $key => $value) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
253 //echo "$key => $value";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
254 if ($key>2047) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
255 //HST added
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
256 break;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
257 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
258 $queryG = "CALL b_addBrowseNode($key,\"$value\")"; //add the name value pair for genre to new table
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
259 //echo $queryG;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
260 include "../../private/db.php";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
261 $resG = mysqli_query($link, $queryG);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
262 mysqli_close($link);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
263
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
264 switch ($loop) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
265 case 1:
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
266 $g1 = $key;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
267 break;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
268 case 2:
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
269 $g2 = $key;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
270 break;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
271 case 3:
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
272 $g3 = $key;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
273 break;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
274 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
275
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
276 $loop++;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
277 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
278
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
279 if($salesRank == "")
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
280 $salesRank = "null";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
281
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
282 if($title != "")
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
283 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
284 include "../../private/db.php";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
285 if ($publisher->count()==0) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
286 $publisher="null";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
287 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
288 else {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
289 $publisher=mysqli_real_escape_string($link,$publisher);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
290 if (strlen($publisher)>30) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
291 $publisher=rtrim(substr($publisher,0,30),"\\");
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
292 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
293 $publisher="\"".$publisher."\"";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
294 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
295 if ($author->count()==0) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
296 $author="unknown";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
297 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
298 else {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
299 $author=mysqli_real_escape_string($link,$author);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
300 if (strlen($author)>30) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
301 $author=rtrim(substr($author,0,30),"\\");
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
302 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
303 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
304 $author="\"".$author."\"";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
305 $title=mysqli_real_escape_string($link,$title);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
306 if (strlen($title)>100) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
307 $title=rtrim(substr($title,0,100),"\\");
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
308 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
309 $title="\"".$title."\"";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
310 $review1 = mysqli_real_escape_string($link,$review1);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
311 if (strlen($review1)>500) { $review1=rtrim(substr($review1,0,500),"\\");}
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
312 $review2 = mysqli_real_escape_string($link,$review2);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
313 if (strlen($review2)>500) { $review2=rtrim(substr($review2,0,500),"\\");}
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
314 $review3 = mysqli_real_escape_string($link,$review3);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
315 if (strlen($review3)>500) { $review3=rtrim(substr($review3,0,500),"\\");}
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
316
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
317 $queryInsert = "CALL b_addNewBook(\"$searchparameterdata\",$title, $author,\"$binding\",\"$imageURL\", $dewey, $salesRank,$pubDate,$publisher,$g1,$g2,$g3,$loc)";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
318 //echo $queryInsert;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
319
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
320 $res = mysqli_query($link, $queryInsert);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
321 if (!$res) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
322 $err=mysqli_error( $link );
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
323 mysqli_close($link);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
324 file_put_contents('/var/ywww/debug/phpDebug',
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
325 "anb failed: $queryInsert\n$err\n",
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
326 FILE_APPEND);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
327 exit($err);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
328 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
329 $queryInsertReviews = "CALL b_insertReviews(\"$searchparameterdata\",\"$review1\",\"$review2\",\"$review3\")";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
330 if($review1 != "") {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
331 $res = mysqli_query($link, $queryInsertReviews);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
332 if (!$res) {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
333 $err=mysqli_error( $link );
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
334 mysqli_close($link);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
335 file_put_contents('/var/ywww/debug/phpDebug',
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
336 "anr failed: $queryInsertReviews\n",
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
337 FILE_APPEND);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
338 exit($err);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
339 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
340 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
341 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
342 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
343
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
344 echo $output;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
345 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
346 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
347
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
348 function getAmazonDetLocal($go,$language,$loc,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
349 $page,$operation,$searchparameter,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
350 $searchparameterdata,
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
351 $show_array,$show_url,$show_xml)
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
352 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
353 global $output;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
354 //look up info from db
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
355 include "../../private/db.php";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
356 $query = "CALL b_getBookInfo('$searchparameterdata', $loc)";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
357 //echo $query;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
358 $res = mysqli_query($link, $query) or exit( mysqli_error( $link ));
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
359
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
360 $output = "";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
361 $output .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
362 $output .= "<Details>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
363 if ( mysqli_num_rows( $res ) > 0 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
364 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
365 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC);
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
366 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
367 $output .= "<ASIN>" . $searchparameterdata . "</ASIN>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
368 $output .= "<Title>" . htmlspecialchars($rows["Title"]) . "</Title>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
369 $output .= "<Author>" . htmlspecialchars($rows["Author"]) . "</Author>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
370 $output .= "<Binding>" . htmlspecialchars($rows["Binding"]) . "</Binding>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
371 $output .= "<Dewey>" . htmlspecialchars($rows["DeweyDecimal"]) . "</Dewey>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
372 $output .= "<ImageURL>" . htmlspecialchars($rows["ImageURL"]) . "</ImageURL>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
373 $output .= "<SalesRank>" . htmlspecialchars($rows["SalesRank"]) . "</SalesRank>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
374 $output .= "<PublicationDate>" . htmlspecialchars($rows["PublicationDate"]) . "</PublicationDate>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
375 $output .= "<Publisher>" . htmlspecialchars($rows["Publisher"]) . "</Publisher>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
376 $output .= "<Genre1>" . htmlspecialchars($rows["Genre1"]) . "</Genre1>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
377 $output .= "<Genre2>" . htmlspecialchars($rows["Genre2"]) . "</Genre2>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
378 $output .= "<Genre3>" . htmlspecialchars($rows["Genre3"]) . "</Genre3>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
379 $output .= "<ProductGroup>Book</ProductGroup>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
380 $output .= "<Error>AccountLimitExceeded</Error>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
381
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
382 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
383 else {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
384 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
385 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
386 $output .= "</Details>";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
387 echo $output;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
388 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
389
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
390 function findGenre($browseNode, &$ID, &$gen)
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
391 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
392 if($browseNode->Name == "Subjects")
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
393 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
394 return true;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
395 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
396 else
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
397 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
398 if($browseNode->Ancestors->BrowseNode)
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
399 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
400 if(findGenre($browseNode->Ancestors->BrowseNode, $ID, $gen) == true)
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
401 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
402 $gen = $browseNode->Name;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
403 $ID = $browseNode->BrowseNodeId;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
404 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
405 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
406 return false;
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
407 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
408 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
409
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
410 if(!isset($ret))
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
411 {
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
412 include "aws_signed_request.php";
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
413 getAmazonDet('default',0,'us'); //will get overwritten from URI params
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
414 // by the foreach ($Adefault as ... loop above
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
415 }
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
416 /*Caught oneSimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
417 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
418 [OperationRequest] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
419 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
420 [RequestId] => d2eaacba-2411-44e7-b268-f23a20167330
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
421 [Arguments] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
422 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
423 [Argument] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
424 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
425 [0] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
426 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
427 [@attributes] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
428 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
429 [Name] => AWSAccessKeyId
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
430 [Value] => AKIAIHTNWC7L6LOUY4LQ
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
431 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
432
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
433 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
434
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
435 [1] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
436 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
437 [@attributes] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
438 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
439 [Name] => AssociateTag
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
440 [Value] => bookwhack-21
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
441 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
442
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
443 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
444
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
445 [2] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
446 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
447 [@attributes] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
448 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
449 [Name] => ItemId
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
450 [Value] => B004Q3Q3Y4
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
451 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
452
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
453 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
454
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
455 [3] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
456 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
457 [@attributes] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
458 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
459 [Name] => ItemPage
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
460 [Value] => 1
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
461 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
462
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
463 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
464
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
465 [4] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
466 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
467 [@attributes] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
468 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
469 [Name] => Operation
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
470 [Value] => ItemLookup
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
471 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
472
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
473 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
474
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
475 [5] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
476 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
477 [@attributes] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
478 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
479 [Name] => ResponseGroup
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
480 [Value] => ItemAttributes,Reviews,EditorialReview,OfferSummary,Offers,Images,AlternateVersions,SalesRank,BrowseNodes
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
481 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
482
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
483 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
484
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
485 [6] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
486 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
487 [@attributes] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
488 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
489 [Name] => ReviewSort
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
490 [Value] => -HelpfulVotes
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
491 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
492
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
493 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
494
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
495 [7] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
496 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
497 [@attributes] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
498 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
499 [Name] => Service
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
500 [Value] => AWSECommerceService
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
501 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
502
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
503 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
504
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
505 [8] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
506 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
507 [@attributes] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
508 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
509 [Name] => Timestamp
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
510 [Value] => 2016-12-15T23:12:34Z
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
511 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
512
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
513 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
514
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
515 [9] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
516 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
517 [@attributes] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
518 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
519 [Name] => Version
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
520 [Value] => 2011-08-01
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
521 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
522
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
523 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
524
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
525 [10] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
526 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
527 [@attributes] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
528 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
529 [Name] => Signature
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
530 [Value] => SUXfFZHQ74Joc+WDLx87uzemTdtHijNohykqafJXYKQ=
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
531 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
532
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
533 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
534
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
535 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
536
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
537 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
538
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
539 [RequestProcessingTime] => 0.3518217620000000
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
540 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
541
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
542 [Items] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
543 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
544 [Request] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
545 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
546 [IsValid] => True
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
547 [ItemLookupRequest] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
548 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
549 [IdType] => ASIN
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
550 [ItemId] => B004Q3Q3Y4
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
551 [ResponseGroup] => Array
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
552 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
553 [0] => ItemAttributes
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
554 [1] => Reviews
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
555 [2] => EditorialReview
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
556 [3] => OfferSummary
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
557 [4] => Offers
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
558 [5] => Images
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
559 [6] => AlternateVersions
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
560 [7] => SalesRank
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
561 [8] => BrowseNodes
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
562 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
563
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
564 [VariationPage] => All
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
565 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
566
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
567 [Errors] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
568 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
569 [Error] => SimpleXMLElement Object
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
570 (
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
571 [Code] => AWS.InvalidParameterValue
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
572 [Message] => B004Q3Q3Y4 is not a valid value for ItemId. Please change this value and retry your request.
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
573 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
574
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
575 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
576
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
577 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
578
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
579 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
580
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
581 )
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
582 */
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
583 /*$xml = new SimpleXMLElement("<?xml version=\"1.0\"?><ItemLookupErrorResponse xmlns=\"http://ecs.amazonaws.com/doc/2009-03-31/\"><Error><Code>AccountLimitExceeded</Code><Message>Account limit of 2056 requests per hour exceeded.</Message></Error><RequestID>290ed059-730c-4789-93b4-6d21e11053d3</RequestID></ItemLookupErrorResponse>");*/
3f400072bf14 merge, involved ediff3 wrt getAmazonInfo.php
Charlie Root
parents: 41 39
diff changeset
584 ?>