Skip to content

Commit 835d87d

Browse files
committed
Disable SSL verify
1 parent 87aa376 commit 835d87d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/CommentsClient.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use GuzzleHttp\Client;
44
use GuzzleHttp\Exception\ClientException;
5+
use GuzzleHttp\Exception\GuzzleException;
56

67
class CommentsClient {
78
const API_URL = 'https://commentanalyzer.googleapis.com/v1alpha1';
@@ -162,9 +163,12 @@ public function communityId(string $communityId) {
162163
*/
163164
protected function request(string $method, array $fields): CommentsResponse {
164165
$data = [];
165-
$client = new Client(['defaults' => [
166-
'headers' => ['content-type' => 'application/json', 'Accept' => 'application/json'],
167-
]]);
166+
$client = new Client([
167+
'verify' => false,
168+
'defaults' => [
169+
'headers' => ['content-type' => 'application/json', 'Accept' => 'application/json']
170+
]
171+
]);
168172

169173
foreach ($fields AS $field) {
170174
if (isset($this->{$field})) {
@@ -174,7 +178,7 @@ protected function request(string $method, array $fields): CommentsResponse {
174178

175179
try {
176180
$response = $client->post(self::API_URL."/comments:{$method}?key={$this->token}", ['json' => $data]);
177-
} catch (ClientException $e) {
181+
} catch (ClientException | GuzzleException $e) {
178182
$error = json_decode($e->getResponse()->getBody(), true);
179183

180184
if (isset($error['error'])) {

0 commit comments

Comments
 (0)