Update myway balance API
--- a/labs/myway_api.json.php
+++ b/labs/myway_api.json.php
@@ -23,7 +23,7 @@
"DOBday" => "day",
"DOByear" => "year",
"secret_answer" => "pwrd",
- "button" => "button"
+ "button" => "Submit"
);
foreach (Array(
"card_number",
@@ -64,6 +64,7 @@
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_REFERER, "https://www.action.act.gov.au/ARTS/getbalance.asp");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
//execute post
@@ -75,6 +76,7 @@
if (!isset($return['error'])) {
include_once ('lib/simple_html_dom.php');
+ //print_r($pageHTML);
$page = str_get_html($pageHTML);
$pageAlerts = $page->find(".smartCardAlert");
if (sizeof($pageAlerts) > 0) {
@@ -94,12 +96,14 @@
$tableColumns[$tableColumnNum] = cleanString($th->plaintext);
$tableColumnNum++;
}
+ //print_r($tableColumns);
$tableRowNum = 0;
foreach ($table->find("tr") as $tr) {
$tableColumnNum = 0;
foreach ($tr->find("td") as $td) {
if ($tableNum == 1) $return[$tableName[$tableNum]][$tableColumns[$tableColumnNum]] = cleanString($td->plaintext);
else $return[$tableName[$tableNum]][$tableRowNum][$tableColumns[$tableColumnNum]] = cleanString($td->plaintext);
+ //print_r($return);
$tableColumnNum++;
}
$tableRowNum++;
--- a/labs/mywaybalance.php
+++ b/labs/mywaybalance.php
@@ -29,8 +29,10 @@
echo '<ul data-role="listview" data-inset="true"><li data-role="list-divider"> Recent Transactions </li>';
$txCount=0;
foreach ($return['myway_transactions'] as $transaction) {
- echo "<li><b>" . $transaction["Date / Time"] . "</b>";
- echo "<br><small>" . $transaction["TX Reference No / Type"] . "</small>";
+ echo "<li>";
+ if ($transaction["Deduction Type"] == "DEFAULT") echo '<img src="css/images/warning.png" alt="Failed to tap off: " class="ui-li-icon">';
+ echo"<b>" . $transaction["Date / Time"] . "</b>";
+ echo "<br><small>" .$transaction["Route"] ." at " . $transaction["Stop Name"]. "<br>". $transaction["TX Reference No / Type"] . "</small>";
echo '<p class="ui-li-aside">' . $transaction["TX Amount"] . '</p>';
echo "</li>";
$txCount++;