<?php require_once dirname(__FILE__) . "/../bulksms/BulkSMS.php"; require_once dirname(__FILE__) . "/../bulksms/AutoRoute.php"; $bulksms = new Blender\Client\BulkSMS(); $USERNAME = "******"; $PASSWORD = "******"; // Login $bulksms->login($USERNAME, $PASSWORD); $autoRoute = new \Blender\Client\AutoRoute($bulksms); //$autoRoute->printRoutes(); $testNumbers = array("61417188345", "44398938433", "12798723829"); foreach ($testNumbers as $recipient) { $routeId = $autoRoute->getRouteId($recipient); echo "Route id for {$recipient}: {$routeId}\n"; }
<?php require_once dirname(__FILE__) . "/../bulksms/BulkSMS.php"; require_once dirname(__FILE__) . "/../bulksms/AutoRoute.php"; $minBalance = 5; $username = "******"; $password = "******"; $alertPhone = "61400000000"; $bulksms = new \Blender\Client\BulkSMS(); $bulksms->login($username, $password); $autoRoute = new \Blender\Client\AutoRoute($bulksms); $balance = $bulksms->getBalance(); if ($balance < $minBalance) { $routeId = $autoRoute->getRouteId($alertPhone); $result = $bulksms->sendSingle("RawMobility", $alertPhone, "Balance Alert: Your current balance is under {$minBalance} ({$balance}), please top up ASAP.", $routeId); } else { echo "All good ({$balance})\n"; }