File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 22
33use GuzzleHttp \Client ;
44use GuzzleHttp \Exception \ClientException ;
5+ use GuzzleHttp \Exception \GuzzleException ;
56
67class 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 ' ])) {
You can’t perform that action at this time.
0 commit comments