if ($_POST['territoryId']) { $TERRITORY_ID = $_POST['territoryId']; } // if an Account Id is passed through, set it if ($_POST['accountId']) { $ACCOUNT_ID = $_POST['accountId']; } /** include the Genability PHP Library */ require_once('../genability.php'); // set your app id and app key $gen = new genability(array( 'app_id' => 'your-app-id-here', // Your Unique Genability Application ID <https://developer.genability.com/admin/applications> 'app_key' => 'your-app-key-here', // Your Unique Genability Application Key <https://developer.genability.com/admin/applications> 'debug' => false, // Debug mode echos API Url & POST data if set to true (Optional) )); // make the getTariff call $output = $gen->getTariff(array( 'masterTariffId'=> $TARIFF_ID, // Unique Genability ID (primary key) for this tariff 'populateRates' => true, // Populates the rate details for this Tariff (Boolean). The PHP Library defaults to false if not set 'territoryId' => $TERRITORY_ID, // When specified, rate changes returned will be for the specified Territory. (Optional) 'accountId' => $ACCOUNT_ID, )); // check to see if this account has accounts $accounts = $gen->getAccounts(); $accounts = json_decode($accounts);
$url .= '?providerAccountId=' . $_POST['providerAccountId']; header('Location: ' . $url); } //echo("<script> top.location.href='" . $url . "'</script>"); //header('Location: ' . $url); } /** include the Genability PHP Library */ require_once('../genability.php'); $appId = 'your-app-id-here'; // Your Unique Genability Application ID <https://developer.genability.com/admin/applications> $appKey = 'your-app-key-here'; // Your Unique Genability Application Key <https://developer.genability.com/admin/applications> // set your app id and app key $gen = new genability(array( 'app_id' => $appId, 'app_key' => $appKey, 'debug' => false, // Debug mode echos API Url & POST data if set to true (Optional) )); print_r($_POST); if ($_POST) { switch ($_POST["action"]) { case "addAccount": $gen->addAccount($_POST); break; case "updateAccount": $gen->updateAccount($_POST); break; case "deleteAccount": $gen->deleteAcount($_POST["accountId"]);
$DEMAND_AMOUNT = $_POST['demandAmount']; } else { $DEMAND_AMOUNT = '500'; } if ($_POST['accountId']) { $ACCOUNT_ID = $_POST['accountId']; } /** include the Genability PHP Library */ require_once('../genability.php'); // set your app id and app key $gen = new genability(array( 'app_id' => 'your-app-id-here', // Your Unique Genability Application ID <https://developer.genability.com/admin/applications> 'app_key' => 'your-app-key-here', // Your Unique Genability Application Key <https://developer.genability.com/admin/applications> 'debug' => false, // Debug mode echos API Url & POST data if set to true (Optional) )); // check to see if this account has accounts $accounts = $gen->getAccounts(); $accounts = json_decode($accounts); // make the getPrice call $output = $gen->getPrice(array( 'masterTariffId' => $TARIFF_ID, // Unique Genability ID (primary key) for this tariff 'fromDateTime' => $FROM_DATE_TIME, // Date and time of the requested start of the Price. In ISO 8601 format. (Required) 'toDateTime' => $TO_DATE_TIME, // Date and time of the requested start of the Price. In ISO 8601 format. (Optional) 'territoryId' => $TERRITORY_ID, // When specified, rate changes returned will be for the specified Territory. (Optional) 'consumptionAmount' => $CONSUMPTION_AMOUNT, // A monthly consumption in kWh. (Optional) 'demandAmount' => $DEMAND_AMOUNT, // A monthly demand in kW. (Optional)