Neu: Blue Archive Steam-Checker hinzugefügt
This commit is contained in:
39
ba_steam/check_steam.php
Normal file
39
ba_steam/check_steam.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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']);
|
||||
}
|
||||
Reference in New Issue
Block a user