詳細画面を製造します。
詳細画面は一覧画面からのリクエストを受けて表示される画面です。
一覧画面からはASINがパラメータとして渡されます。
同パラメータを使ってItemSearchを行います。
detail.php
<!-- 詳細画面 --> setLocale( LOCAL ); // 取得オプション設定 $options = array(); // 返却情報設定 $options['ResponseGroup'] = RESPONSE_GROUP; // 結果の格納 $xml= $amazon -> ItemLookup( $asin, $options ); if( PEAR::isError( $xml ) ) { // エラーメッセージ echo "Amazonの個別商品ページでお使いください。"; } else { // 商品詳細情報作成 $data = $xml['Item'][0]; $html = ""; $html .= create_item_detail_info( $data, false ); $url = $data['DetailPageURL']; $img = $data['MediumImage']['URL']; $url_img_kari = substr( $img, 0, strrpos( $img, "/" ) + 1 ); // イメージIDの取得 $img_id = strrchr( $img, "/"); $cut_s = strpos( $img_id, "/" ) + 1; $cut_e = strpos( $img_id, "." ) - 1; $img_id =substr( $img_id, $cut_s, $cut_e ); $url_img = $url_img_kari. $img_id. "._SS". $max_px ."_.jpg"; $tag = ""; // 画像用のタグ $tag .= '<a href="'. $url .'" rel="nofollow">'; $tag .= '<img src="'. $url_img .'" style="border: none" alt="'. $data['ItemAttributes']['Title'] .'" />'; $tag .= '</a>'; $tag .= '<br />'; // テキスト用のタグ $tag .= '<a href="'. $url .'" rel="nofollow">'; $tag .= $data['ItemAttributes']['Title']; $tag .= '</a>'; } ?> <!-- 本体 --> <h2>商品詳細</h2> <br /> <h2>作成イメージ</h2> <br /> <h2>貼りつけ用コード</h2> <textarea rows="20" cols="40" name="text1" /></textarea> <br /> <!-- form start --> <form name="form" method="post" action="detail.php"> <!-- hidden --> <input type="hidden" name="asin" value="" /> <!-- 入力項目 --> <span>アソシエイトID</span><br /> <input type="text" name="aso_id" size="10" value="" /> <span>画像サイズ</span><br /> <input type="text" name="max_px" size="3" value="" /> px <br /> <br /> </form>