Skip to content

Commit

Permalink
USSD example
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrajina committed Oct 19, 2012
1 parent 63f41b5 commit d85def9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions oneapi-sample-app/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<li/> <a href='send-message-form.php'>Send message</a>
<li/> <a href='send-roaming-status-form.php'>Check mobile phone roaming status</a>
<li/> <a href='inbound-message.php'>Inbound message example</a>
<li/> <a href='ussd.php'>USSD</a>
</ul>
</body>
</html>
31 changes: 31 additions & 0 deletions oneapi-sample-app/ussd.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

require_once 'app.php';

if($_REQUEST['gsm']) {
$gsm = $_REQUEST['gsm'];
$ussdClient = new UssdClient(USERNAME, PASSWORD);

$response = null;
while($response != '1') {
$result = $ussdClient->sendMessage($gsm, "You favourite mobile API is\n1. Parseco\n2. Other");
$response = $result->message;
}
$ussdClient->stopSession($gsm, "Cool");

echo "<h1>Session finished</h1>";
}

?>
<html>
<head>
<title>USSD</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<h1>Start USSD session</h1>
<form method="GET">
GSM: <input type="text" name="gsm"/> <input type="submit" value="Start USSD" />
</form>
</body>
</html>

0 comments on commit d85def9

Please sign in to comment.