2014-12-23 1 views
2

wanze에서 [Google Analytics API PHP]를 사용하고 있습니다. 인증 (웹 인증 만 사용) 및 모든 것을 설정할 수 있었고 세션에 토큰을 저장했습니다. 다른 페이지에서이 코드를 사용하여 사용자가 로그인 한 모든 계정을 찾습니다.YouTube Analytics API PHP : usageLimits accessNotConfigured

Array 
(
    [http_code] => 403 
    [error] => Array 
     (
      [errors] => Array 
       (
        [0] => Array 
         (
          [domain] => usageLimits 
          [reason] => accessNotConfigured 
          [message] => Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration. 
          [extendedHelp] => https://console.developers.google.com 
         ) 

       ) 

      [code] => 403 
      [message] => Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration. 
     ) 

) 
<br /> 
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home3/chalzzy/public_html/dashboard/dashboard.php</b> on line <b>21</b><br /> 
Array 
(
) 

은 내가 제거하거나 모든 설정해야 많은 장소에서 볼 수있는 콘솔에서 "추천"절에서 의미하지만 난 수없는 것 :

session_start(); 
include('GoogleAnalyticsAPI.class.php'); 

$ga = new GoogleAnalyticsAPI(); 
$ga->auth->setClientId('replaces'); // From the APIs console 
$ga->auth->setClientSecret('replaces'); // From the APIs console 
$ga->auth->setRedirectUri('replaced'); // Url to your app, must match one in the APIs console 

// Get the Auth-Url 
$url = $ga->auth->buildAuthUrl(); 

// Set the accessToken and Account-Id 
$ga->setAccessToken($_SESSION['accessToken']); 
$ga->setAccountId('ga:xxxxxxx'); 

// Load profiles 
$profiles = $ga->getProfiles(); 
print_r($profiles); 
$accounts = array(); 
foreach ($profiles['items'] as $item) { 
    $id = "ga:{$item['id']}"; 
    $name = $item['name']; 
    $accounts[$id] = $name; 
} 
// Print out the Accounts with Id => Name. Save the Id (array-key) of the account you want to query data. 
// See next chapter how to set the account-id. 
print_r($accounts); 

나는이 반환 새로운 또는 오래된 콘솔에서 그 지느러미. URL이 있거나 찾을 수없는 경우 URL 또는 스크린 샷을 보내 주시겠습니까? 또한

이 나는이 프로젝트에 설치 한 모든 API가 있습니다 : 사전에

List of API

감사합니다,

는 또한

, 당신이 더 필요하면 알려주세요 세부!

답변

2

이봐 당신이해야 할 것은 Developers Console에 API를 목록 "웹 로그 분석 API"를 추가입니다

, (나는 그것이 아주 바보 같은 질문을했다 미안 해요).

+0

그래서 질문이 닫 혔습니까? –

+0

@SalmanA 예. 그렇습니다. 그것은 내게 나쁜 질문이었다. – Speedysnail6

+0

@ Speedysnail6 당신의 현상금에 작별 인사 : D – Rizier123