0
Guzzle을 사용하여 HTTP 요청을 Gmail API (으)로 보냅니다.Guzzle Google API 서버 500에 HTTP 요청을 보냅니다.
이 부분은 계속해서 서버 500 오류가 발생합니다. 그 이유는 무엇입니까?
$data = new stdClass;
$data-> 'topicName' ='projects/sample.com:sample/topics/topic';
$data-> 'labelIds' = ["INBOX"];
$data-> 'labelFilterAction' = 'include';
전체 코드 :
require_once __DIR__.'/vendor/autoload.php';
$client = new Google_Client();
$client->setScopes("https://www.googleapis.com/auth/gmail.readonly");
putenv('GOOGLE_APPLICATION_CREDENTIALS=sample.json');
$client->useApplicationDefaultCredentials();
// returns a Guzzle HTTP Client
$httpClient = $client->authorize();
$data = new stdClass;
$data->'topicName' ='projects/sample.com:sample/topics/topic';
$data-> 'labelIds' = ["INBOX"];
$data-> 'labelFilterAction' = 'include';
$request = new GuzzleHttp\Psr7\Request('POST', 'https://www.googleapis.com/gmail/v1/users/[email protected]/watch',['Content-type'=>'application/json'],$data);
$response = $httpClient->send($request);
var_dump($response);