<?php
require('calldata.php');
$p = $_GET['p'];
$a = $_GET['a'];
$t = $_GET['t'];
$i = $_GET['i'];
$co = $_GET['co'];
$ch = $_GET['ch'];
$sql = "INSERT INTO book3 (a,t,p,i,ch,co) VALUES ('$a','$t','$p','$i',$ch,'$co')";
$result = mysql_query($sql);
mysql_close($link);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ren</title>
<script src="jquery.js"></script>
<script src="utf.js"></script>
<script src="sample.js"></script>
</head>
<body>
著者
<textarea id="author"></textarea>
<br>
タイトル
<textarea id="title"></textarea>
<br>
感想
<textarea id="com"></textarea>
<br>
<p id="memo"></p>
<input type="button" value="検索" onClick="sample()" />
<input type="button" value="記録" onClick="play()" />
</body>
</html>
var author,title,isbn,com,picx;
function sample(){
var str1,str2;
var str,urlx;
var a1=$("#author").val();
var t1=$("#title").val();
var c1=$("#com").val();
com = c1;
str1=utf.URLencode(a1);
str2=utf.URLencode(t1);
urlx = "search.php?a=" + str1 + "&t=" + str2;
$.get(urlx, function (data) {
str = "";
for (var i in data) {
str = str + data[i];
}
var p1, p2;
p1 = str.indexOf("title");
p1 = str.indexOf(":", p1);
p2 = str.indexOf(",", p1);
title = str.substring(p1 + 1, p2);
title = change(title);
p1 = str.indexOf("author");
p1 = str.indexOf(":", p1);
p2 = str.indexOf(",", p1);
author = str.substring(p1 + 1, p2);
author = change(author);
p1 = str.indexOf("isbn");
p1 = str.indexOf(":", p1);
p2 = str.indexOf(",", p1);
isbn = str.substring(p1 + 1, p2);
isbn = change(isbn);
p1 = str.indexOf("largeImageUrl");
p1 = str.indexOf(":", p1);
p2 = str.indexOf(",", p1);
pic = str.substring(p1 + 1, p2);
picx = change(pic);
var memo;
memo = title + "<br>" + author + "<br>" + isbn;
memo = memo + "<br>" + c1 + "<br>";
memo = memo + "<br><img src=" + pic + ">";
$("#memo").html(memo);
});
}
function change(str){
var strx;
strx=str.replace("\"", "");
strx=strx.replace("\"", "");
return strx;
}
function play(){
var urlx;
urlx = "book.php?a=" +author;
urlx = urlx+"&t=" +title;
urlx = urlx+"&i=" +isbn;
urlx = urlx+"&p=" +picx;
urlx = urlx+"&co=" +com;
urlx = urlx+"&ch=" +100;
$.get(urlx, function (data) {
$("#memo").html("記録済み");
});
}
<?php
$author = $_GET['a'];
$title = $_GET['t'];
$urlx="https://app.rakuten.co.jp/services/api/BooksBook/Search/20130522?applicationId=cc7aedb3ecd1a722df68c90e98298864&author=";
$urlx=$urlx.$author;
$urlx=$urlx."&title=";
$urlx=$urlx.$title;
$str = file_get_contents($urlx);
print($str);
?>
最終更新:2013年12月15日 09:51