PHP calls TextMagicAPI to send text messages. PHP needs to use a third-party API to send text messages online. the following code calls TextMagicAPI to send text messages: viewsourceprint? 0102 introduce TextMagicPHP library file PHP for online text messaging. you need to use a third-party API. the following code calls TextMagic API to send text messages:
View sourceprint? 01
02 // introduce the TextMagic PHP library file
03 require ('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 '2017-345-5678'
11 $ result = $ router-> send ('Wake up! ', Array (2223455678), true );
12 // result (official materials): Array ([messages] => Array ([19896128] => 9991234567) [sent_text] => Wake up! [Parts_count] => 1)
13?>
If there is no TextMagic API class library, you can download here: TextMagic-SMS-API php sms module class
Using APIs to send text messages: view sourceprint? 01 02 // introduce the TextMagic PHP library file...