0

我想通过其 isbn 编号搜索书籍信息并检索信息并显示/存储信息的结果。

例如,我使用了以下网址

https://www.googleapis.com/books/v1/volumes?q=isbn:9789381141977

{
 "kind": "books#volumes",
 "totalItems": 1,
 "items": [
  {
   "kind": "books#volume",
   "id": "j5jFmAEACAAJ",
   "etag": "7QZKCyFvQv0",
   "selfLink": "https://www.googleapis.com/books/v1/volumes/j5jFmAEACAAJ",
   "volumeInfo": {
    "title": "Wireless Communication Systems",
    "authors": [
     "Rajeshwar Dass, Sr."
    ],
    "publishedDate": "2012-11-27",
    "industryIdentifiers": [
     {
      "type": "ISBN_10",
      "identifier": "9381141975"
     },
     {
      "type": "ISBN_13",
      "identifier": "9789381141977"
     }
    ],
    "pageCount": 200,
    "printType": "BOOK",
    "categories": [
     "Science"
    ],
    "contentVersion": "preview-1.0.0",
    "language": "en",
    "previewLink": "http://books.google.co.in/books?id=j5jFmAEACAAJ&dq=isbn:9789381141977&hl=&cd=1&source=gbs_api",
    "infoLink": "http://books.google.co.in/books?id=j5jFmAEACAAJ&dq=isbn:9789381141977&hl=&source=gbs_api",
    "canonicalVolumeLink": "http://books.google.co.in/books/about/Wireless_Communication_Systems.html?hl=&id=j5jFmAEACAAJ"
   },
   "saleInfo": {
    "country": "IN",
    "saleability": "NOT_FOR_SALE",
    "isEbook": false
   },
   "accessInfo": {
    "country": "IN",
    "viewability": "NO_PAGES",
    "embeddable": false,
    "publicDomain": false,
    "textToSpeechPermission": "ALLOWED",
    "epub": {
     "isAvailable": false
    },
    "pdf": {
     "isAvailable": false
    },
    "webReaderLink": "http://books.google.co.in/books/reader?id=j5jFmAEACAAJ&hl=&printsec=frontcover&output=reader&source=gbs_api",
    "accessViewStatus": "NONE"
   }
  }
 ]
}

现在我想从上面获取标题、作者、页数并使用 PHP 在我的页面中打印?

4

1 回答 1

6

您可能会发现这很有用

$page = file_get_contents("https://www.googleapis.com/books/v1/volumes?q=isbn:9789381141977");

$data = json_decode($page, true);

echo "Title = " . $data['items'][0]['volumeInfo']['title'];
echo "Authors = " . @implode(",", $data['items'][0]['volumeInfo']['authors']);    
echo "Pagecount = " . $data['items'][0]['volumeInfo']['pageCount'];
于 2013-11-06T12:26:42.973 回答