Message-ID: <1625059914.15715.1614957790525.JavaMail.confluence@wiki> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_15714_1923679988.1614957790524" ------=_Part_15714_1923679988.1614957790524 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
<?php //Send an SMS include_once('TMRestClient.php'); $tmClient =3D new TMRestClient('MyUser', 'MyPass', 'production'); $tmClient->sendSMS('Hello SMS World!', '447000000000', 'SenderName'); ?>=20
<?php //Get credits available include_once('TMRestClient.php'); $tmClient =3D new TMRestClient('MyUser', 'MyPass', 'production'); $creditsAvailable =3D $tmClient->getCredits(); ?>=20
<?php //Get a delivery report of all messages sent include_once('TMRestClient.php'); $tmClient =3D new TMRestClient('MyUser', 'MyPass', 'production'); $result =3D $tmClient->getDeliveryReport('all'); foreach ($result as $key =3D> $report) { =09foreach ($report['reportrow'] as $key =3D> $reportrow) { =09=09echo "Msg ID: {$reportrow['message_id']}, to: {$reportrow['mobil= e_number']}, is: {$reportrow['status']}<br/>\n"; =09} } ?>=20
<?php //Create a sub-account include_once('TMRestClient.php'); $tmClient =3D new TMRestClient('MyUser', 'MyPass', 'production'); $tmClient->createSubAccount('My client', '447000000000'); ?>=20
<?php //Transfer 5000 credits to another account include_once('TMRestClient.php'); $tmClient =3D new TMRestClient('MyUser', 'MyPass', 'production'); $tmClient->transferCreditsToUser(5000, 'targetAPIusername', 'targetAPIpa= ssword'); ?>=20
<?php include_once('TMRestClient.php'); $tmClient =3D new TMRestClient('MyUser', 'MyPass', 'production'); try { =09$success =3D false; =09$tmClient->sendSMS('Hello SMS World!', '447000000000', 'SenderName'); =09// if the send fails, execution jumps to the start of the catch-block =09$success =3D true;=20 =09$creditsAvailable =3D $tmClient->getCredits(); } catch (Exception $exception) { =09$errors =3D $tmClient->getLastErrors(); =09foreach($errors as $errorcode =3D> $errormsg) =09=09echo "Code $errorcode: $errormsg"; } if (!$success) =09echo "There was a problem sending the message"; else =09echo "There are $creditsAvailable credits left"; ?>=20
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.