Skip to content

Instantly share code, notes, and snippets.

@pixelbrackets
Created February 25, 2021 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixelbrackets/c8b4b890cacf505ab0925f7eb7947ff1 to your computer and use it in GitHub Desktop.
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
<?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