Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
1
10php
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yu Kimiduka
10php
Commits
f241ac60
Commit
f241ac60
authored
Jul 13, 2016
by
君塚 悠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
プログラム作製(amazon.php:amazonのウェブサービス利用)
parent
94206d33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
amazon.php
php/php10/day06-2/amazon.php
+49
-0
No files found.
php/php10/day06-2/amazon.php
0 → 100644
View file @
f241ac60
<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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment