Richard
Richard

Reputation: 4546

use off sms gateway third party api

I have a question about the use off the http api from the company clickatell.

They actually have several api that you can use, amongst are xml and smtp also.

Does anyone have any experience with those, especially with the http api.

For the http api:

Does this php code actually doing the work in the background?

This line $ret = file($url); - I am sorry, I haven't setup anything yet to test it. I am just trying to find out wich api I can start testing with -.

Also, is there a performance difference between using smtp api and http api?

// SMS gateway script
    $user = "XXXX";
    $password = "XXXXXX";
    $api_id = "XXXXXX";
    $baseurl ="http://api.clickatell.com";
    $text = urlencode("HTTP://WWW.TIMES.COM/DOWNLOADS/SUGRAFREE.SISX");
    $to = $_POST["phone number"];
 // auth call
    $url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id";
    // do auth call
    $ret = file($url);
    // split our response. return string is on first line of the data returned
    $sess = split(":",$ret[0]);
    if ($sess[0] == "OK") {
    $sess_id = trim($sess[1]); // remove any whitespace
    $url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
    // do sendmsg call
    $ret = file($url);
    $send = split(":",$ret[0]);
    if ($send[0] == "ID")
    echo "An Email with account details and SMS has been sent..

thanks, Richard

Upvotes: 0

Views: 1174

Answers (1)

dusoft
dusoft

Reputation: 11479

I have experience with clickatell API - a good one.

SMTP is slower - you need your email to get to the clickatell servers. which could take a second or a minute.

HTTP is much better and recommended, moreover you can create one session and send multiple sms in one go.

ps: i have not tested your code, but it should work, although i would recommend checking CURL library for HTTP connections.

Upvotes: 1

Related Questions