0

次のスクリプトは、google api php クライアントによって提供されます。

<?php
require_once 'src/Google_Client.php';
require_once 'src/contrib/Google_CustomsearchService.php';
session_start();

$client = new Google_Client();
$client->setApplicationName('Google CustomSearch PHP Starter Application');
$client->setDeveloperKey('API KEY');
$search = new Google_CustomsearchService($client);

try{
     $result = $search->cse->listCse('burrito', array('cx' => 'SEARCH ENGINE ID'));
     print "<pre>" .print_r($result, true) . "</pre>";
}catch(Exception $e)
{
     echo("<pre>".print_r($e,true)."</pre>");
}
?>

スクリプトを実行するcustom searchと、タブで が有効になっている場合でも、次のエラーが表示されservicesます。

Google_ServiceException Object
(
    [errors:protected] => Array
        (
            [0] => Array
                (
                    [domain] => usageLimits
                    [reason] => accessNotConfigured
                    [message] => Access Not Configured
                )

        )
4

2 に答える 2

1

このエラーは、API コンソールから有効にしていない API にアクセスしようとしたときにも発生する可能性があります。

API コンソールに移動し、まずそこから API を有効にします。

于 2013-08-10T11:50:04.173 に答える
0

https://code.google.com/apis/console

register your IPv6 address not the IPv4

于 2013-06-26T03:57:00.223 に答える