laravel-sms-api icon indicating copy to clipboard operation
laravel-sms-api copied to clipboard

cURL error 28: Failed to connect to xxx.xxx.xx.xxx port xxxx:

Open RumnazKhan opened this issue 2 years ago • 1 comments

in config/sms-api

return [

    'country_code' => 'xxx', //Country code to be added
    'default' => env('SMS_API_DEFAULT_GATEWAY', 'gateway_name_basic'), //Choose default gateway
    
//    Basic Gateway Sample Configuration
    'gateway_name_basic' => [
        'method' => 'GET', //Choose Request Method (GET/POST) Default:GET
        'url' => 'http://xxx.xxx.xx.xxx:xxxx/sendtext?', //Base URL
        'params' => [
            'send_to_param_name' => 'toUser', //Send to Parameter Name
            'msg_param_name' => 'messageContent', //Message Parameter Name
            'others' => [
                'apikey' => 'xxxxxxxxxxxxxxx',
                'secretkey' => 'xxxxxxx',
                //More params can be added
            ],
        ],
        'headers' => [
            'header1' => '',
            'header2' => '',
            //More headers can be added
        ],
        'add_code' => true, //Include Country Code (true/false)
    ],

in sms controller:

<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use SmsApi;


class SmsController extends Controller
{

    /*
     *
     * about settings
     *
    */

    public function testSendMessageResponse()
    {
        $response = SmsApi::sendMessage("000000000987", "Hi");
         return $response;
    }


}

it returns the following error: cURL error 28: Failed to connect to 192.168.18.119 port 1222: Timed out (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) f

RumnazKhan avatar May 29 '22 08:05 RumnazKhan

Looks more like the API host issue. Can you share the API Doc of your service provider.

gr8shivam avatar Jun 05 '22 05:06 gr8shivam