/** * @brief 商品の詳細を取得 * @param $isbn_code (i) * @retval 商品の表示情報 * @date 2005/03/17 doublebass * @note */ function _get_product($isbn_code) { $text = ''; $sql = "SELECT * FROM " . $this->p_log_isbn_table . " WHERE asin='" . $isbn_code . "' LIMIT 1"; if (!($res = mysql_query($sql))) { $text .= mysql_error(); return $text; } $rows = mysql_num_rows($res); //データベースに登録されてないか、期限切れなら検索 if ($rows != 0) { $row = mysql_fetch_array($res); $expire = $this->expire; if ($row['date'] + $expire > time()) { $not_found = false; } else { $not_found = true; //期限切れなら登録を削除 $sql = 'DELETE FROM ' . $this->p_log_isbn_table . " WHERE asin='" . $isbn_code . "'"; if (!mysql_query($sql)) { $text .= mysql_error(); return $text; } } } else { $not_found = true; } $soap = new SoapClient("http://soap.amazon.co.jp/schemas3/AmazonWebServices.wsdl"); $param = array('asin' => $isbn_code, 'tag' => $this->associate_id, 'type' => 'lite', 'devtag' => $this->develop_token, 'locale' => "jp"); // Request & Result $result = $soap->AsinSearchRequest($param); // $items = $result['Details']; // $items = $result->Details; //データベースに登録 /* if ($not_found == true) { $data = serialize($items); $date = time(); $sql = 'INSERT INTO ' . $this->p_log_isbn_table . '(`asin`, `data`, `date`) '. "VALUES('{$isbn_code}', '{$data}', '{$date}'".")"; if (!mysql_query($sql)) { $text .= mysql_error(); return $text; } } */ //詳細情報を取り出す foreach ($result->Details as $r) { $url = ''; $title = ''; $authors = ''; $manufacturer = ''; // $list_price = ''; $our_price = ''; $time = ''; $availability = ''; $image_url = ''; //'http://images-jp.amazon.com/images/G/09/x-locale/detail/thumb-no-image.gif'; if (isset($r->Url)) { $url = $r->Url; } if (isset($r->ProductName)) { $title = htmlspecialchars($r->ProductName); } if (isset($r->Authors)) { $authors = $r->Authors; } if (is_array($authors)) { $authors = join(" , ", $authors); } if (isset($r->Manufacturer)) { $manufacturer = $r->Manufacturer; } if (isset($r->ListPrice)) { $list_price = $r->ListPrice; } if (isset($r->OurPrice)) { $our_price = $r->OurPrice; } if (isset($r->ReleaseDate)) { $time = $r->ReleaseDate; } if (isset($r->Availability)) { $availability = $r->Availability; } if (isset($r->ImageUrlMedium)) { $image_url = $r->ImageUrlMedium; } $text .= '<a href="' . $url . '">' . '<img class="float-left" src="' . $image_url . '" title="' . $title . '" alt="' . $title . '" /></a>' . $title . '<br />' . '( ' . $manufacturer . ' )<br />'; if ($authors != "") { $text .= $authors . '<br />'; } else { $text .= ''; } $text .= $our_price . '<br class="float-clear" />'; } return $text; }