Created
February 25, 2021 10:50
-
-
Save pixelbrackets/c8b4b890cacf505ab0925f7eb7947ff1 to your computer and use it in GitHub Desktop.
Test Firewall - Minimal script to prove to hosters that access to certain domains is not possible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// composer require guzzlehttp/guzzle | |
require __DIR__ . '/vendor/autoload.php'; | |
use GuzzleHttp\Client; | |
$client = new Client(['timeout' => 2]); | |
$urls = [ | |
'https://example.com', | |
'https://wikipedia.de/', | |
'https://api.my-domain.de/', | |
'https://stageing.my-domain.de/index.php?id=53&L=0', | |
'https://my-domain.de/index.php?id=53&L=0' | |
]; | |
foreach ($urls as $url) { | |
echo PHP_EOL . $url . ' '; | |
try { | |
$response = $client->request('GET', $url); | |
} catch (Exception $e) { | |
echo 'Error ' . print_r($e->getMessage(), true); | |
continue; | |
} | |
print_r($response->getStatusCode()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment