When we get the barcode of the book, we can use WebResponse and HttpWebRequest to get the information of the book from Douban. Get the address of the book information:
"Http://api.douban.com/book/subject/isbn/plus the book's barcode, can be only numbers, can also be added in the middle"-"(not including quotes) such as: 978-7-115-18103-9.
Note that the returned data needs to be encoded using UTF-8, and if GB2312 is used, it will be garbled.
Add the following function to the project, call it in the appropriate place, and pass in the ISBN number to get information about the book.
public string Getbookinfo (string ISBN)
{
String url = "http://api.douban.com/book/subject/isbn/";
HttpWebRequest request = (HttpWebRequest) httpwebrequest.create (url + ISBN);
WebResponse response = Request. GetResponse ();
StreamReader reader = new StreamReader (response. GetResponseStream (), encoding.getencoding ("Utf-8"));
String BookInfo = reader. ReadToEnd ();
Reader. Close ();
Reader. Dispose ();
Response. Close ();
return BookInfo;
}
In the absence of application for Douban Apikey, only 10 times per minute, if the application can be reached 40 times.
To include Apikey, the URL at the time of the access is changed to:
Http://api.douban.com/book/subject/isbn/ISBN?APIKEY= your apikey , which ISBN is the ISBN, finally your apikey need to replace your number.