Send SMS from Web (are there some providers for this)?

痴心易碎 提交于 2019-12-05 13:27:52
moander

You can use the ViaNett HTTP API to send SMS messages worldwide without specifying the operator.

As long as your backend supports invoking HTTP requests it will work.

Here is an example written in PHP:

<?php

// Register here to get a username and password:
// http://www.vianett.com/en/free-demonstration-account

if (vianett_sendsms('username', 'password', 'example', '+4412345678', 'Hello world', $error)) {
    echo 'Success!';
} else {
    echo $error;
}

function vianett_sendsms($username, $password, $from, $to, $msg, &$response=null) {
    $url = 'https://smsc.vianett.no/v3/send.ashx';
    $data = array(
        'user'  => $username,
        'pass'  => $password,
        'src'   => $from,
        'dst'   => $to,
        'msg'   => $msg
    );
    $qs = http_build_query($data);
    $response = file_get_contents($url.'?'.$qs);
    return $response == '200|OK';
}

We're getting good results from http://www.twilio.com

For direct SMS, you can try contacting a service provider and make a contract with it. If its for small projects and the server is accessible, you could put a GPRS mobile phone or modem and send with it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!