当前位置:Gxlcms > PHP教程 > PHP调用调用TextMagicAPI发送短信_PHP教程

PHP调用调用TextMagicAPI发送短信_PHP教程

时间:2021-07-01 10:21:17 帮助过:28人阅读

  PHP实现在线发短信,需要借助第三方API,以下代码就是调用了TextMagic API来实现发送短信的功能:

  view sourceprint?01

  02//引入TextMagic PHP库文件

  03require('textmagic-sms-api-php/TextMagicAPI.php');

  04$username = 'myusername';

  05$password = 'mypassword';

  06$router = new TextMagicAPI(array(

  07 'username' => $username,

  08 'password' => $password

  09));

  10//发送一条信息到'222-345-5678'

  11$result = $router->send('Wake up!', array(2223455678), true);

  12//结果(官方资料): Array ( [messages] => Array ( [19896128] => 9991234567 ) [sent_text] => Wake up! [parts_count] => 1 )

  13?>

  若没有TextMagic API类库的可在这里下载:TextMagic-SMS-API PHP发送短信模块类

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/755618.htmlTechArticlePHP实现在线发短信,需要借助第三方API,以下代码就是调用了TextMagic API来实现发送短信的功能: view sourceprint?01 02//引入TextMagic PHP库文件...

人气教程排行