2017-09-11 3 views
1

Google 번역 API를 처음 사용했습니다. 나는 단지 1 개의 요청 만 통과했다, 그리고 그것은 실패하기 시작했다. 일일 한도를 초과했다는 오류가 나타납니다. 내 결제 계정이 연결되어 있습니다. API가 활성화됩니다. 액세스 토큰이 생성되어 test cURL 요청을 통해 작동하고 있습니다.403 Google 번역 API 일일 한도 초과

<?php 

namespace App\Http\Controllers; 

use Illuminate\Http\Request; 

# Imports the Google Cloud client library 
use Google\Cloud\Translate\TranslateClient; 

class GoogleTranslateController extends Controller 
{ 

    # Your Google Cloud Platform project ID 
    private $projectId = 'my_project_id'; 

    public function translate() 
    { 

    //$content, $targetLanguage 
    # Instantiates a client 
      $translate = new TranslateClient([ 
       'projectId' => $this->projectId 
      ]); 

    # The text to translate 
      $text = 'Hello, world!'; 
    # The target language 
      $target = 'es'; 

    # Translates some text into Russian 
      $translation = $translate->translate($text, [ 
       'target' => $target 
      ]); 

     return $translation['text']; 
    } 


} 
+0

어떻게 부르시겠습니까? –

+0

끝점에 도달했을 때이를 호출하는 경로가 있습니다. Route :: get ('get/translate', 'GoogleTranslateController @ translate'); 그래서 지금은 http : // localhost : 8000/get/translate로 테스트하여 테스트 결과를 얻습니다. –

답변

0

오늘 시도 후, API가 작동합니다

여기 내 시험 방법에 대한 내 코드입니다. 활성화로 인한 시간 지연이 있는지 여부는 알 수 없습니다. 이전에 다른 Google Api에서이 문제를 겪었습니다.