Got it — since you’re on cPanel hosting, we can’t use “serverless functions” like Vercel. Instead, I’ll adapt this so it works with PHP on your hosting.
Here’s the plan:
- You’ll upload **two files**: the HTML page and a small PHP script.
- The PHP script will store your Kinetix API key securely and make the API calls.
- Your HTML page will call the PHP script instead of directly talking to Kinetix.
---
**File 1 — index.html** (your main page)
```html
NBN Address Checker — CyKat / Kinetix
NBN Address Checker
```
---
**File 2 — proxy.php** (this hides your API key)
```php
'Missing address']);
exit;
}
$address = urlencode($_GET['address']);
// Step 1: Find location ID
$locRes = file_get_contents($baseUrl . "/address/search?query={$address}", false, stream_context_create([
'http' => [
'header' => "Authorization: Bearer {$apiKey}\r\nAccept: application/json\r\n"
]
]));
$locData = json_decode($locRes, true);
// Extract Location ID from response
$locId = $locData['items'][0]['loc_id'] ?? null;
if (!$locId) {
echo json_encode(['error' => 'No LOC found', 'raw' => $locData]);
exit;
}
// Step 2: Service qualification
$sqRes = file_get_contents($baseUrl . "/service_qualification/single_site?location_id={$locId}", false, stream_context_create([
'http' => [
'header' => "Authorization: Bearer {$apiKey}\r\nAccept: application/json\r\n"
]
]));
$sqData = json_decode($sqRes, true);
// Step 3: Fibre uplift check
$fuRes = file_get_contents($baseUrl . "/service_qualification/fibre_uplift?location_id={$locId}", false, stream_context_create([
'http' => [
'header' => "Authorization: Bearer {$apiKey}\r\nAccept: application/json\r\n"
]
]));
$fuData = json_decode($fuRes, true);
// Output all
$result = [
'locationId' => $locId,
'serviceQualification' => $sqData,
'fibreUplift' => $fuData
];
echo json_encode($result);
```
---
**How to use:**
1. Replace `YOUR_KINETIX_API_KEY` in `proxy.php` with your real Kinetix key.
2. Upload both files (`index.html` and `proxy.php`) to your hosting.
3. Visit the page in your browser, enter an address, and it will return the data.
Do you want me to now modify this so it **formats the results nicely** instead of just dumping raw JSON?