Closed savifon closed 2 years ago
I have the same problem
Hi Can you provide me with the code you are using including the parameters your passing in and i'll try to figure out what the issue is.
I'm using the documentation code, just changing the token and phone number and device id.
<?php
require 'autoload.php';
use SMSGatewayMe\Client\ApiClient;
use SMSGatewayMe\Client\Configuration;
use SMSGatewayMe\Client\Api\MessageApi;
use SMSGatewayMe\Client\Model\SendMessageRequest;
// Configure client
$config = Configuration::getDefaultConfiguration();
$config->setApiKey('Authorization', 'TOKEN');
$apiClient = new ApiClient($config);
$messageClient = new MessageApi($apiClient);
// Sending a SMS Message
$sendMessageRequest1 = new SendMessageRequest([
'phoneNumber' => 'PHONE NUMBER',
'message' => 'test1',
'deviceId' => ID DEVICE
]);
$sendMessageRequest2 = new SendMessageRequest([
'phoneNumber' => 'PHONE NUMBER',
'message' => 'test2',
'deviceId' => ID DEVICE
]);
$sendMessages = $messageClient->sendMessages([
$sendMessageRequest1,
$sendMessageRequest2
]);
print_r($sendMessages);
?>
The following error is returned:
Fatal error: Uncaught SMSGatewayMe\Client\ApiException: API call to https://smsgateway.me/api/v4/message/send timed out: a:26:{s:3:"url";s:41:"https://smsgateway.me/api/v4/message/send";s:12:"content_type";N;s:9:"http_code";i:0;s:11:"header_size";i:0;s:12:"request_size";i:0;s:8:"filetime";i:-1;s:17:"ssl_verify_result";i:1;s:14:"redirect_count";i:0;s:10:"total_time";d:0.25;s:15:"namelookup_time";d:9.9999999999999995E-7;s:12:"connect_time";d:0.25;s:16:"pretransfer_time";d:0;s:11:"size_upload";d:0;s:13:"size_download";d:0;s:14:"speed_download";d:0;s:12:"speed_upload";d:0;s:23:"download_content_length";d:-1;s:21:"upload_content_length";d:-1;s:18:"starttransfer_time";d:0;s:13:"redirect_time";d:0;s:12:"redirect_url";s:0:"";s:10:"primary_ip";s:13:"54.229.39.139";s:8:"certinfo";a:0:{}s:12:"primary_port";i:443;s:8:"local_ip";s:15:"186.202.119.229";s:10:"local_port";i:49643;} in E:\Vhosts\painell.com\httpdocs\testesmssavio\lib\ApiClient.php:230 Stack trace: #0 E:\Vhosts\painell.com\httpdocs\testesmssavio\lib\Api\MessageApi.php(525) in E:\Vhosts\painell.com\httpdocs\testesmssavio\lib\ApiClient.php on line 230
And it does not have in the documentation the adjustments that we must make in the previous version to work correctly.
I am running PHP version 7.0.29
Hi, So from the error message it seems that you can not connect to the endpoint at all (rather than it being an issue with the server rejecting your request). I'm trying to setup a PHP 7.029 environment now to test it and will get back to you soon.
In the meantime maybe check that your server has no issues making outward connections.
The server accepts external connections, yes. So much so that in the previous version, sending SMS worked normally.
Same here. @sepehrs I think we all are using same server as in V3. So, it's probably not a problem on our server. Please, check it out PHP 5.x too.
this @Ludplay code apparently solved my problem!!!
$array_fields['phone_number'] = '+00226497491';
$array_fields['message'] = 'Test';
$array_fields['device_id'] = 00000;
$token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOxxxxxxxxxxxxxxxxxxxxxxx";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://smsgateway.me/api/v4/message/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "[ " . json_encode($array_fields) . "]",
CURLOPT_HTTPHEADER => array(
"authorization: $token",
"cache-control: no-cache"
),
));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
I've created a class similar to v3. Hope it helps. https://github.com/Ludplay/smsgatewayme-php-endpoint
savifon thank U so much............... You pulled me out of trouble guys follow his code
For those having this error, all you need to do is change ../lib/Configuration.php line 143 from true to false
protected $sslVerification = false; // this will fix it
Ludplay gracias me ayudo mucho
It's not a good practice to modify vendor files. Instead of changing /lib/Configuration.php add one line of code in your file where are you sending sms:
require 'vendor/autoload.php';
use SMSGatewayMe\Client\ApiClient;
use SMSGatewayMe\Client\Configuration;
use SMSGatewayMe\Client\Api\MessageApi;
use SMSGatewayMe\Client\Model\SendMessageRequest;
$config = Configuration::getDefaultConfiguration();
$config->setSSLVerification(false); // add this line
...
Thanks a lot Savifon. You saved my very very valuable time.
Same issue `2019-05-07 19:22:47.377424 [NOTICE] [172.69.54.163:51016] [STDERR] PHP Fatal error: Uncaught SMSGatewayMe\Client\ApiException: [400] Error connecting to the API (https://smsgateway.me/api/v4/message/send) in /var/www/visit/public/dashboard/vendor/smsGateway/lib/ApiClient.php:247 Stack trace:
Any idea ?
It seems the server is down. My application does not send messages since 04/05/2019 (last saturday). Sad. I don't know who to appeal to.
thank you @isolutionpl you save my day #4
$config->setSSLVerification(false); // add this line
I'm using the documentation code, just changing the token and phone number and device id.
<?php require 'autoload.php'; use SMSGatewayMe\Client\ApiClient; use SMSGatewayMe\Client\Configuration; use SMSGatewayMe\Client\Api\MessageApi; use SMSGatewayMe\Client\Model\SendMessageRequest; // Configure client $config = Configuration::getDefaultConfiguration(); $config->setApiKey('Authorization', 'TOKEN'); $apiClient = new ApiClient($config); $messageClient = new MessageApi($apiClient); // Sending a SMS Message $sendMessageRequest1 = new SendMessageRequest([ 'phoneNumber' => 'PHONE NUMBER', 'message' => 'test1', 'deviceId' => ID DEVICE ]); $sendMessageRequest2 = new SendMessageRequest([ 'phoneNumber' => 'PHONE NUMBER', 'message' => 'test2', 'deviceId' => ID DEVICE ]); $sendMessages = $messageClient->sendMessages([ $sendMessageRequest1, $sendMessageRequest2 ]); print_r($sendMessages); ?>
The following error is returned:
Fatal error: Uncaught SMSGatewayMe\Client\ApiException: API call to https://smsgateway.me/api/v4/message/send timed out: a:26:{s:3:"url";s:41:"https://smsgateway.me/api/v4/message/send";s:12:"content_type";N;s:9:"http_code";i:0;s:11:"header_size";i:0;s:12:"request_size";i:0;s:8:"filetime";i:-1;s:17:"ssl_verify_result";i:1;s:14:"redirect_count";i:0;s:10:"total_time";d:0.25;s:15:"namelookup_time";d:9.9999999999999995E-7;s:12:"connect_time";d:0.25;s:16:"pretransfer_time";d:0;s:11:"size_upload";d:0;s:13:"size_download";d:0;s:14:"speed_download";d:0;s:12:"speed_upload";d:0;s:23:"download_content_length";d:-1;s:21:"upload_content_length";d:-1;s:18:"starttransfer_time";d:0;s:13:"redirect_time";d:0;s:12:"redirect_url";s:0:"";s:10:"primary_ip";s:13:"54.229.39.139";s:8:"certinfo";a:0:{}s:12:"primary_port";i:443;s:8:"local_ip";s:15:"186.202.119.229";s:10:"local_port";i:49643;} in E:\Vhosts\painell.com\httpdocs\testesmssavio\lib\ApiClient.php:230 Stack trace: #0 E:\Vhosts\painell.com\httpdocs\testesmssavio\lib\Api\MessageApi.php(525) in E:\Vhosts\painell.com\httpdocs\testesmssavio\lib\ApiClient.php on line 230
And it does not have in the documentation the adjustments that we must make in the previous version to work correctly.
Thank you @savifon
Hello
When trying to run the sample code from readme.md, it gives the following error, even from this token:
Exception when calling CallbackApi->createCallback: API call to https://smsgateway.me/api/v4/callback timed out: a:26:{s:3:"url";s:37:"https://smsgateway.me/api/v4/callback";s:12:"content_type";N;s:9:"http_code";i:0;s:11:"header_size";i:0;s:12:"request_size";i:0;s:8:"filetime";i:-1;s:17:"ssl_verify_result";i:1;s:14:"redirect_count";i:0;s:10:"total_time";d:0.5;s:15:"namelookup_time";d:0.26600000000000001;s:12:"connect_time";d:0.48399999999999999;s:16:"pretransfer_time";d:0;s:11:"size_upload";d:0;s:13:"size_download";d:0;s:14:"speed_download";d:0;s:12:"speed_upload";d:0;s:23:"download_content_length";d:-1;s:21:"upload_content_length";d:-1;s:18:"starttransfer_time";d:0;s:13:"redirect_time";d:0;s:12:"redirect_url";s:0:"";s:10:"primary_ip";s:13:"54.229.39.139";s:8:"certinfo";a:0:{}s:12:"primary_port";i:443;s:8:"local_ip";s:15:"186.202.119.229";s:10:"local_port";i:60781;}
And when you try to send an SMS according to documentation, the following error is displayed:
Fatal error: Uncaught SMSGatewayMe\Client\ApiException: API call to https://smsgateway.me/api/v4/message/send timed out: a:26:{s:3:"url";s:41:"https://smsgateway.me/api/v4/message/send";s:12:"content_type";N;s:9:"http_code";i:0;s:11:"header_size";i:0;s:12:"request_size";i:0;s:8:"filetime";i:-1;s:17:"ssl_verify_result";i:1;s:14:"redirect_count";i:0;s:10:"total_time";d:0.25;s:15:"namelookup_time";d:9.9999999999999995E-7;s:12:"connect_time";d:0.25;s:16:"pretransfer_time";d:0;s:11:"size_upload";d:0;s:13:"size_download";d:0;s:14:"speed_download";d:0;s:12:"speed_upload";d:0;s:23:"download_content_length";d:-1;s:21:"upload_content_length";d:-1;s:18:"starttransfer_time";d:0;s:13:"redirect_time";d:0;s:12:"redirect_url";s:0:"";s:10:"primary_ip";s:13:"54.229.39.139";s:8:"certinfo";a:0:{}s:12:"primary_port";i:443;s:8:"local_ip";s:15:"186.202.119.229";s:10:"local_port";i:60798;} in E:\Vhosts\painell.com\httpdocs\testesmssavio\lib\ApiClient.php:230 Stack trace: #0 E:\Vhosts\painell.com\httpdocs\testesmssavio\lib\Api\MessageApi.php(525) in E:\Vhosts\painell.com\httpdocs\testesmssavio\lib\ApiClient.php on line 230