public static function getInstance() { if (self::$_instance == null) { // 楽天APIの初期化 self::$_client = new RakutenRws_Client(); self::$_client->setApplicationId(Config::get('const.RAKUTEN_API_ID')); self::$_instance = new self(); } return self::$_instance; }
public function postSearch() { $params = Input::all(); // 楽天商品の検索 $rakuten_gestion = Rakuten::getInstance(); $rakuten_items = $rakuten_gestion->searchItemByKeyword($params['itemKeyword']); // Amazon商品の検索 $amazon_gestion = Amazon::getInstance(); $amazon_items = $amazon_gestion->searchItemByKeyword($params['itemKeyword']); $results = array_merge($rakuten_items, $amazon_items); header('Content-Type: application/json'); echo json_encode($results); exit; }