"구글 API 튜토리얼 2 - ISBN으로 책정보 조회"의 두 판 사이의 차이

87번째 줄: 87번째 줄:
==같이 보기==
==같이 보기==
*[[구글 API 시작하기]]
*[[구글 API 시작하기]]
*[[ISBN]]


==주석==
==주석==

2015년 6월 14일 (일) 22:40 판

1 개요

구글 책 API 시작하기
구글 책 API 튜토리얼
구글 책 API 사용하여 ISBN으로 책정보 조회
  • 여기서는 기본으로 제공된 예제를 사용하지 않고 간단히 새로 만들어 본다.
  • 단 사용하던 라이브러리의 위치를 정리하고 가자...

2 사전 작업

3 라이브러리 폴더 이동

  • Google 폴더를 PHP 라이브러리를 모아두는 폴더(여기서는 /var/www/php_lib/)로 이동
[root@zetawiki examples]# mv ../src/Google /var/www/php_lib/
[root@zetawiki examples]# ll /var/www/php_lib/ | grep Google
drwxr-xr-x 12 root root 4096 Apr 18 23:54 Google

4 my_book_client2.php 작성

  • 홈폴더로 이동하여 새 파일을 만들어 보자.
물론 DeveloperKey는 자신의 것을 입력해야 함[1]
[root@zetawiki examples]# cd
[root@zetawiki ~]# vi my_book_client2.php
<?php
require_once '/var/www/php_lib/Google/autoload.php';

$client = new Google_Client();
$client->setDeveloperKey("AIzaSyBDEuxz8GIb0K2df4_hjlMOQSU68npWYrA");
$service = new Google_Service_Books($client);

$volumes = $service->volumes->listVolumes("isbn:8996276553");
print_r($volumes);

5 테스트

  • my_book_client2.php를 실행해보자.
[root@zetawiki ~]# php my_book_client2.php 
Google_Service_Books_Volumes Object
(
    [collection_key:protected] => items
    [internal_gapi_mappings:protected] => Array
        (
        )

    [itemsType:protected] => Google_Service_Books_Volume
    [itemsDataType:protected] => array
    [kind] => books#volumes
    [totalItems] => 1
    [modelData:protected] => Array
        (
            [items] => Array
                (
                    [0] => Array
                        (
                            [kind] => books#volume
                            [id] => i5XebwAACAAJ
                            [etag] => 3Diz3Ui7Xek
                            [selfLink] => https://www.googleapis.com/books/v1/volumes/i5XebwAACAAJ
                            [volumeInfo] => Array
                                (
                                    [title] => JQUERY 쿡북(실전)(초이스 시리즈 2)
                                    [authors] => Array
                                        (
                                            [0] => JQUERY 코어커뮤니티
                                        )

                                    [publishedDate] => 2010-07-01
                                    [industryIdentifiers] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [type] => ISBN_10
                                                    [identifier] => 8996276553
                                                )

                                            [1] => Array
                                                (
                                                    [type] => ISBN_13
                                                    [identifier] => 9788996276555
... (생략)

6 같이 보기

7 주석

  1. 소스코드에 포함된 DeveloperKey는 엉터리 값이므로 제대로 실행되지 않습니다...

8 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}