user3423412
user3423412

Reputation: 1

sms api using php not working even it is error free

I am trying to send SMS using an API its working fine in my local but it is not working in remote server and it s not giving any error also. if any 1 knows the reason for this then please tell me the solution

following code i am using

`function execute($url) {

    $ch=curl_init();
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $output=curl_exec($ch);

    curl_close($ch);

    return $output;

}   `

Upvotes: 0

Views: 991

Answers (2)

You could check the 46elks git repo with examples of how to make requests without CURL in PHP to send SMS, as well as some other examples for receiving SMS and make and receive phone calls.

Upvotes: 1

alez007
alez007

Reputation: 276

You need libcurl library installed on that machine in order to use php-curl extension. Also look in php.ini if you have extension=php_curl.so uncommented. Try to add this code to make sure everything is fine:

    if(function_exists('curl_exec')) {
       echo 'curl is running';
    } else {
       echo 'curl is not running';
    }

Also, don't you have any post fields for the request ? You can do that with CURLOPT_POSTFIELDS. Documentation is here

Upvotes: 0

Related Questions