brightcove / PHP-API-Wrapper

This project provides a starting point for integrating the Brightcove CMS API into your application. It provides simple ways to interact with the API, as well as a long list of helper functions.
25 stars 33 forks source link

Issue with Client connection #26

Open iammeenugupta96 opened 7 years ago

iammeenugupta96 commented 7 years ago

Hi Tamsad,

I'm integrating https://www.drupal.org/project/brightcove in one of my drupal project. Setting up the module requires this library to be installed https://github.com/brightcove/PHP-API-Wrapper/

I integrated this almost a month back. It was all working fine. We were able to connect to the client and communicate with Brightcove studio.

Suddenly from last two days it has stopped working and error which we get is:

Brightcove\API\Exception\APIException: Invalid status code: expected 200-299, got 0. in Brightcove\API\Client->request() (line 274 of /var/www/drupal-7.38/sites/all/libraries/PHP-API-Wrapper/lib/Brightcove/API/Client.php).

Thereafter, I tried with new release of the library and today installed https://github.com/brightcove/PHP-API-Wrapper/ allover again. But no luck.

Can you please suggest what could be the issue.

janmashat commented 7 years ago

Please enable debug logging in lib/Brightcove/API/Client.php and post the results... public static $debugRequests = "/tmp/bc.log";

Also you didn't mention what versions of the module and wrapper you're using.

iammeenugupta96 commented 7 years ago

Sure, will enable the logging. I'm using Drupal 7.34 and brightcove module 7.x-6.4 and this latest version of php-api-wrapper.

iammeenugupta96 commented 7 years ago

By the way, thank you for your response.

janmashat commented 7 years ago

Module version 7.x-6.4 requires version 0.8 of the wrapper.

iammeenugupta96 commented 7 years ago

Okay, even with that version facing issues.

integrated this almost a month back. It was all working fine. We were able to connect to the client and communicate with Brightcove studio.

Suddenly from last two days it has stopped working and error which we get is:

Brightcove\API\Exception\APIException: Invalid status code: expected 200-299, got 0. in Brightcove\API\Client->request()

So the $code is 0. I'll debug more on this and get back to you.

Please let me know if you have any clue why we get 0 as $code value. Not sure why it suddenly stopped working.

janmashat commented 7 years ago

It's difficult to say without the debug log.

DrLightman commented 3 years ago

In my case, from localhost, I had the same issue and the fired exception message was empty and the log of this kind:

array (
  'request' => false,
  'request_body' => 'grant_type=client_credentials',
  'response' => 
  array (
    0 => 0,
    1 => '',
  ),
  'response_headers' => '',
)

Since I had already met this kind of issue with other libraries, I tried the same "fix" and it worked. It's related to SSL, I added these lines into curl_set_opt_array next to the others, in Client.php, HTTPRequest method:

CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_PROXY_SSL_VERIFYPEER => 0,
CURLOPT_PROXY_SSL_VERIFYHOST => 0,