Commit f241ac60 authored by 君塚 悠's avatar 君塚 悠

プログラム作製(amazon.php:amazonのウェブサービス利用)

parent 94206d33
<html>
<head>
<title>Amazon Webサービスの活用</title>
</head>
<body>
<h1 style= "background: #ccccc">Amazonの書籍検索</h1>
<form method = "POST" action = "<?php $_SERVER ['PHP_SELF'] ?>">
キーワード:
<input type = "text" name = "keywd" size = "30" maxlength = "255"
value = "<?php print($_POST['keywd']); ?>" />
<input type = "submit" value = "検索" />
</form>
<?php
//キーワードが入力されていた場合
if ($_POST['keywd'] != '') {
$kyewd = mb_convert_encoding(
htmlspecialchars($_POST['kyewd']), "UTF-8", "auto");
//キーワード検索を実行
$objSoap = new SoapClient("http://soap.amazon.co.jp/achemas3/AmazonWebServices.wsdl");
$param = array('keyword' => $keywd, 'mode' => 'books-jp', 'locale' => 'jp',
'sort' => '+salesrank', 'type' => 'lite', 'page' => 1,
'tag' => 'XXXXXXXX', 'devtag' => 'XXXXXXXXXXXXXXXX' );
$result = $objSoap -> KeywordSearchRequest($param);
mb_convert_variables("EUC-JP", "auto", $result);
print($result -> TotalResults."件がヒットしました。");
print("<table border = '1'");
print("<th>署名</th><th>No.</th>><th>署名</th><th>著者</th><th>出版社</th>");
print("<th>刊行日</th><th>価格</th>");
foreach ($result -> Details as $item) {
?>
<!-- 検索結果の記述 -->
<tr>
<td><?php print(++$i)?></td>
<td>
<a href = "<?php print($item -> Url); ?> ">
<?php print($item -> ProductName); ?></a></td>
<td><?php print(implode(",", $item -> Authors)); ?></td>
<td><?php print($item -> Manufacturer); ?></td>
<td><?php print($item -> ReleaseDate); ?></td>
<td><?php print($item -> ListPrice); ?></td>
</tr>
<?php
}
}
?>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment