username = "pphapiuser"; $client->key = "12^blow^lift^WHEEL^03"; $client->encryption = "SHA-512"; $client->platform = PLATFORM_LIVE;$req = new IcukApiRequest(); $req->url = $apiMethod; $req->method = $method; if(!is_null($body)) $req->body = $body;$res = $client->send($req); if ($res->success) { $result = $res->response; } else { http_response_code($res->statusCode); $result = $res->errorMessage; } // $result = "GOT API REQUEST"; return $result; }/** * Gets the broadband checker form. * @return HTML form which sends broadband checker requests to the API. */ function getBroadbandCheckerForm() { $checkerType = isset($_GET["checker_type"]) ? $_GET["checker_type"] : ""; $cli = isset($_GET["cli"]) ? $_GET["cli"] : ""; $postCode = isset($_GET["postcode"]) ? $_GET["postcode"] : "";if($checkerType == "" || (!$checkerType == "cli" && !$checkerType == "postcode")) $checkerType = "cli";$html = "

Welcome to the Broadband Availability checker. This will provide a provisional check of your ability to receive Broadband services. Simply enter your phone number or post code to start a search. A phone number check will produce the most accurate result.


" : "/>") . "
" : "/>") . "

"; return $html; }function bb_main() {// Head $html = " Broadband Availability Checker ";// Header $html .= "

Broadband Checker

Confirm products and speeds available

";// Content $html .="

Availability & Estimated Speed

Use our checker tool to confirm the availability of broadband products to your line

"; // Broadband checker form $html .= getBroadbandCheckerForm();$html .= "
";$html .= "";$html .= "";echo $html; }$action = isset($_GET["action"]) ? $_GET["action"] : ""; if($action == 'broadband-availability-cli') { $cli = isset($_GET["cli"]) ? $_GET["cli"] : ""; echo apiRequest('/broadband/availability/' . $cli, 'GET', NULL); return; } else if($action == 'address-search') { $postcode = isset($_GET["postcode"]) ? $_GET["postcode"] : ""; echo apiRequest('/broadband/address_search/' . $postcode, 'GET', NULL); return; } else if($action == 'broadband-availability-exact') { $exactAddress = ($_POST) ? $_POST['address'] : NULL; echo apiRequest('/broadband/availability', 'POST', $exactAddress); } else bb_main(); ?>