Create index.php

This commit is contained in:
Nasir Hafeez
2023-08-07 15:18:27 +05:00
committed by GitHub
parent 14a71c6804
commit f633a6399b

43
Alta/index.php Normal file
View File

@@ -0,0 +1,43 @@
<?php
$token = $_GET["token"];
// Authorization Secret configured in Alta portal against this SSID
$secret = "testing123";
// API endpoint for user authorization
$api_url = "https://api.prod.manage.alta.inc/wifi/auth"
$curl = curl_init();
$postData = [
"token" => $token,
"secret" => $secret
];
curl_setopt_array($curl, array(
CURLOPT_URL => $api_url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($postData),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
if ($response !== false) {
$json = json_decode($response, true);
echo $json;
}
else {
die("Error: check with your network administrator");
}
?>