2016-12-15 5 views
0

Google API를 사용하는 것이 처음입니다. 내 음성을 텍스트로 변환하고 그 반대는 Google 음성 인식을 사용하려고합니다. 그러나 Google 음성 API를 사용하는 방법을 모릅니다. 이 명령을 사용하여 Google 클라우드 패키지를 다운로드합니다.Google 클라우드 음성 API 사용 방법

그러나이 사용법은 잘 모릅니다. 나는이 링크에서 튜토리얼 https://github.com/GoogleCloudPlatform/google-cloud-php을 따라 가고있다. 하지만 오류가 표시됩니다.

Fatal error: Uncaught Google\Cloud\Exception\ServiceException: Could not load the default credentials. Browse to https://developers.google.com/accounts/docs/application-default-credentials for more information in /var/www/html/googlevoice/vendor/google/cloud/src/RequestWrapper.php:221 
Stack trace: 

#0 /var/www/html/googlevoice/vendor/google/cloud/src/RequestWrapper.php(185): Google\Cloud\RequestWrapper->convertToGoogleException(Object(DomainException)) 
#1 /var/www/html/googlevoice/vendor/google/cloud/src/RequestWrapper.php(167): Google\Cloud\RequestWrapper->fetchCredentials() 
#2 /var/www/html/googlevoice/vendor/google/cloud/src/RequestWrapper.php(150): Google\Cloud\RequestWrapper->getToken() 
#3 /var/www/html/googlevoice/vendor/google/cloud/src/RequestWrapper.php(131): Google\Cloud\RequestWrapper->signRequest(Object(GuzzleHttp\Psr7\Request)) 
#4 /var/www/html/googlevoice/vendor/google/cloud/src/RestTrait.php(78): Google\Cloud\RequestWrapper->send(Object(GuzzleHttp\Psr7\Request), Array) 
#5 /var/www/html/googlevoice/vendor/goo in /var/www/html/googlevoice/vendor/google/cloud/src/RequestWrapper.php on line 221 
+0

그리고 당신은 주어진 링크를 수행 할 때 어떤 일이 발생 : 당신이 다음을 수행 할 수 있습니다 거기에서 https://googlecloudplatform.github.io/google-cloud-php/#/docs/latest/guides/authentication

메시지 자체에서 너에게? ---> https://developers.google.com/accounts/docs/application-default-credentials – DaImTo

+0

나는 어떤 것도 얻지 못했습니다. 나는 단지 위의 오류가 발생했습니다. –

+0

자격 증명 자습서를 다시 작성하십시오. 코드가 읽을 수 없습니다. – DaImTo

답변

0

먼저 서비스 계정 자격 증명을 생성해야하는 것처럼 보입니다. :).

얻을하기 위해이 가이드를 참조하세요 그 설정 :

require 'vendor/autoload.php'; 

use Google\Cloud\Storage\StorageClient; 

// Pass the key file directly into your client. 
$storage = new StorageClient([ 
    'keyFilePath' => '/path/to/service/credentials.json' 
]); 

// OR 

// Store the key file as an environment variable 
putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/credentials.json'); 

$storage = new StorageClient(); 
+0

답장을 보내 주신 David S님께, –

+0

나는 bu에게 제공된 링크에있는 모든 API를 사용하도록 설정합니다. 그 후 오류가 발생합니다. 치명적 오류 : 잡히지 않은 Google \ Cloud \ Exception \ ServiceException : { "오류": "deleted_client", "error_description": "OAuth 클라이언트가 삭제되었습니다." } /var/www/html/googlevoice/vendor/google/cloud/src/RequestWrapper.php:219 –

+0

의 흥미 롭습니다! 아직 시도하지 않았다면 서비스 계정 자격 증명을 다시 생성하는 것이 좋습니다. 그래도 문제가 해결되지 않으면 https://cloud.google.com/support/에서 직접 지원팀에 문의합니다. –