Message-ID: <342371426.15713.1614957776500.JavaMail.confluence@wiki> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_15712_1539472547.1614957776499" ------=_Part_15712_1539472547.1614957776499 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
To send an SMS with our PHP wrapper, download and unzip the wrapper from= here.
Then copy the TMRestClient.php file into your class path, = or the folder you are running the code from.
Now put the following code somewhere in a PHP file and execute it to sen= d an SMS =E2=80=93 don't forget to substitute your own API username and pas= sword and a real mobile number to send to!
include_once('TMRestClient.php'); $tmClient =3D new TMRestClient('myAPIusername', 'myAPIpassword', 'productio= n'); $sent =3D false; try { =09$sent =3D $tmClient->sendSMS('My message', '447000000000', 'Sender'); } catch (Exception $ex) { =09$errors =3D $tmClient->getLastErrors(); } if ($sent) =09echo "Message sent with ID " . $sent['message_id']; else =09foreach($errors as $errorcode =3D> $errormsg) =09=09echo "Error encountered with code $errorcode: $errormsg\n";==20
For more details about the additional arguments the send SMS function can take, and other important conside= rations of sending messages, see send sm= s.
In a real situation you must decide how to deal with any errors, we also= recommend logging all errors. See the Handling errors - PHP section below for more details.
You can find your API username and password (which may be different to y= our web interface username/password) via your account: https://messagebox.textmarketer.co.uk/#!accountsettings/=
If you don't have an account, you can set one up for free at www.textmarketer.co.uk.
You must know!
=20 =20Our example code is an illustra= tion of how you might integrate with our systems and is not certified for p= roduction environments. You are responsible for testing and QA.