1
0
Files
PonyWave-Tools/ba_steam/check_steam.php
2025-07-06 21:45:24 +02:00

39 lines
1.2 KiB
PHP

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
header('Content-Type: application/json; charset=utf-8');
$url = 'https://store.steampowered.com/app/3557620/Blue_Archive/?l=german';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; PonyWave-Tools/1.0)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$html = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curl_error = curl_error($ch);
curl_close($ch);
if ($html === false) {
echo json_encode([
'error' => 'Fehler beim Laden der Seite',
'curl_error' => $curl_error,
'http_code' => $httpcode
]);
exit;
}
if ($httpcode !== 200) {
echo json_encode([
'error' => 'HTTP-Statuscode nicht 200',
'http_code' => $httpcode,
'html_snippet' => substr($html, 0, 500)
]);
exit;
}
// Nach dem Sperr-Hinweis suchen
if (strpos($html, 'Dieses Produkt steht in Ihrem Land derzeit nicht zur Verfügung.') !== false) {
echo json_encode(['status' => 'not_available', 'source' => 'steam']);
} else {
echo json_encode(['status' => 'available', 'source' => 'steam']);
}