Home > Backend Development > PHP Tutorial > PHP calls TextMagic API to send text messages_PHP tutorial

PHP calls TextMagic API to send text messages_PHP tutorial

WBOY
Release: 2016-07-13 10:32:30
Original
1141 people have browsed it

To implement online text messaging in PHP, you need to use a third-party API. The following code calls the TextMagic API to implement the function of sending text messages:

view sourceprint?01

 02//Introducing TextMagic PHP library file

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//Send a message to '222-345-5678'

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

 12//Result (official information): Array ( [messages] => Array ( [19896128] => 9991234567 ) [sent_text] => Wake up! [parts_count] => 1 )

 13?>

If you don’t have the TextMagic API class library, you can download it here: TextMagic-SMS-API PHP SMS module class

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/755618.htmlTechArticlePHP needs to use a third-party API to send text messages online. The following code calls the TextMagic API to send text messages. Function: view sourceprint?01 02//Introduce TextMagic PHP library file...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template