コード例 #1
0
     $requestor = new AmazonRequestor($keyword);
     $requestor->runRequest();
     $amazonData = $requestor->extractNecessaryData();
     echo generateTable($amazonData, 'amazon');
     break;
 case 'start':
     echo "<table class='table table-striped table-bordered'>\r\n\t\t\t\t<thead>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>From</th>\r\n\t\t\t\t\t\t<th>Picture</th>\r\n\t\t\t\t\t\t<th>Title</th>\r\n\t\t\t\t\t\t<th>Price</th>\r\n\t\t\t\t\t\t<th>Feedback</th>\r\n\t\t\t\t\t\t<th>Shipping Cost</th>\r\n\t\t\t\t\t\t<th>URL</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</thead>\r\n\t\t\t\t<tbody>";
     break;
 case 'end':
     echo "\t</tbody>\r\n\t\t\t</table>";
     break;
 case 'details':
     $store = $_POST['store'];
     $id = $_POST['id'];
     if ($store == 'ebay') {
         echo EbayRequestor::getItemDetailsURL($_POST['id']);
     } elseif ($store == 'amazon') {
         echo AmazonRequestor::getItemDetailsURL($_POST['id']);
     }
     break;
 case 'suggestion':
     $re = new GoogleRequestor($_POST['keyword']);
     echo json_encode($re->generateSuggestions());
     break;
 case 'youtube':
     $re = new GoogleRequestor($_POST['keyword'] . " Product Review");
     $videoList = $re->getYouTubeVideos();
     foreach ($videoList as $k => $v) {
         echo "\t<div class='col-sm-15 col-md-15 col-lg-15' data-title='{$k}' data-src='{$v['url']}'>\r\n\t\t\t\t\t\t<img src='{$v['thumbnail']}' class='col-sm-12 col-md-12 col-lg-12 img-youtube' data-toggle='modal' data-target='#modal-youtubeVideo' /><br />\r\n\t\t\t\t\t\t<div class='row'>\r\n\t\t\t\t\t\t\t<div class='col-sm-offset-1 col-md-offset-1 col-lg-offset-1 col-sm-5 col-md-5 col-lg-5'>Views: {$v['views']}</div>\r\n\t\t\t\t\t\t\t<div class='col-sm-5 col-md-5 col-lg-5'><div class='pull-right'>{$v['duration']}</div></div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>";
     }
     break;