Php 如何在web应用程序中使用GoogleBookAPI

Php 如何在web应用程序中使用GoogleBookAPI,php,Php,我正在为我的web应用程序使用GoogleBookAPI。设置环境后,我运行了以下代码: <?php session_start(); require_once dirname(__FILE__).'/GoogleClientApi/Google_Client.php'; require_once dirname(__FILE__).'/GoogleClientApi/contrib/Google_AnalyticsService.php'; $scriptUri = "http://"

我正在为我的web应用程序使用GoogleBookAPI。设置环境后,我运行了以下代码:

<?php
session_start();
require_once dirname(__FILE__).'/GoogleClientApi/Google_Client.php';
require_once dirname(__FILE__).'/GoogleClientApi/contrib/Google_AnalyticsService.php';

$scriptUri = "http://".$_SERVER["HTTP_HOST"].$_SERVER['PHP_SELF'];

$client = new Google_Client();
$client->setAccessType('online'); // default: offline
$client->setApplicationName('My Application name');
$client->setClientId('INSERT HERE');
$client->setClientSecret('INSERT HERE');
$client->setRedirectUri($scriptUri);
$client->setDeveloperKey('INSERT HERE'); // API key

// $service implements the client interface, has to be set before auth call
$service = new Google_AnalyticsService($client);

if (isset($_GET['logout'])) { // logout: destroy token
unset($_SESSION['token']);
die('Logged out.');
}

if (isset($_GET['code'])) { // we received the positive auth callback, get the token and store it    in session
$client->authenticate();
$_SESSION['token'] = $client->getAccessToken();
}

if (isset($_SESSION['token'])) { // extract token from session and configure client
$token = $_SESSION['token'];
$client->setAccessToken($token);
}

if (!$client->getAccessToken()) { // auth call to google
$authUrl = $client->createAuthUrl();
header("Location: ".$authUrl);
die;
}
echo 'Hello, world.';
我关注了以下链接:

但我得到SSL连接错误。我已将项目文件夹保存在xxamp的htDocs中