true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $token,
'Square-Version: 2024-01-18',
'Content-Type: application/json',
],
CURLOPT_TIMEOUT => 15,
]);
$resp = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($code === 200) {
$data = json_decode($resp, true);
$locations = $data['locations'] ?? [];
} else {
$error = "HTTP $code: " . htmlspecialchars($resp);
}
?>
Square Location ID Finder
๐ Square Location Finder
TomGames โ Run once, then delete this file
Error fetching locations:
= $error ?>
No locations found on this Square account.
Found = count($locations) ?> location(s). Copy the ID for your main location:
= htmlspecialchars($loc['name']) ?> = $loc['status'] === 'ACTIVE' ? 'โ
' : 'โ ๏ธ ' . $loc['status'] ?>
= htmlspecialchars($loc['id']) ?>
= htmlspecialchars($loc['address']['address_line_1'] ?? '') ?>
= htmlspecialchars($loc['address']['city'] ?? '') ?> ยท
Currency: = htmlspecialchars($loc['currency'] ?? 'USD') ?> ยท
Country: = htmlspecialchars($loc['country'] ?? 'โ') ?>
๐ Next Steps
- Copy your Location ID above
- Open
includes/config.php
- Replace
YOUR_LOCATION_ID with your copied ID
- Also update
DB_PASS with your MySQL password
- Delete this file from your server!
โ ๏ธ Security: Delete get_location.php from your server after use. It exposes your access token.