I have the following problem:
I am using the code for sending a fax as it is published in the official documentation.
// Send Fax
$request = $rcsdk->createMultipartBuilder()
->setBody(array(
'to' => array(
array('phoneNumber' => xxxxxxxxxxxxx),
),
'faxResolution' => 'High',
))
->add('Plain Text', 'file.txt')
->add(fopen('https://developers.ringcentral.com/assets/images/ico_case_crm.png', 'r'))
->request('/account/~/extension/~/fax');
//print $request->getBody() . PHP_EOL;
$response = $platform->sendRequest($request);
print 'Sent Fax ' . $response->json()->uri . PHP_EOL;
This works perfectly for me in my local development environment. (Windows 10, WampServer, php 7.2.25, Laravel 5.5.9). But when I do the deploy in LIVE (aws, ngix, php 7.2.25, Laravel 5.5.9) it doesn't send the fax and it gives me the following error:
ERROR: 400 Bad Request (and additional error happened during JSON parse: Response is not JSON) {"userId":00,"email":"xxxxxx@xxx.com","exception":"[object] (RingCentralSDKHttpApiException(code: 400): 400 Bad Request (and additional error happened during JSON parse: Response is not JSON) at /home/forge/onemed.us/vendor/ringcentral/ringcentral-php/src/Http/Client.php:52, Exception(code: 0): Response has unsuccessful status at /vendor/ringcentral/ringcentral-php/src/Http/Client.php:44)
[stacktrace]
#0 vendor/ringcentral/ringcentral-php/src/Platform/Platform.php(310): RingCentralSDKHttpClient->send(Object(GuzzleHttpPsr7Request))
#1 app/Http/Controllers/RingCentralController.php(353): RingCentralSDKPlatformPlatform->sendRequest(Object(GuzzleHttpPsr7Request))
This occurs when there are files attached to the fax. When there is none, the fax is sent
I have read in other threads that there are users with some similar problems but they do not detail the solution.