diff --git a/test_www.php b/test_www.php
index ad88d34..97ba112 100644
--- a/test_www.php
+++ b/test_www.php
@@ -4,24 +4,46 @@ header('Content-Type: text/html; charset=utf-8');
$responseHeaders = '';
$responseCode = 0;
$url = '';
-$timeout = 5; // domyślny timeout
+$timeout = 5;
+$userAgent = '';
+$customUserAgent = '';
+
+$standardUserAgents = [
+ 'Chrome' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36',
+ 'Firefox' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:117.0) Gecko/20100101 Firefox/117.0',
+ 'Safari' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15',
+ 'Edge' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.0.0',
+ 'curl' => 'curl/7.88.1'
+];
if (isset($_GET['url']) && filter_var($_GET['url'], FILTER_VALIDATE_URL)) {
$url = $_GET['url'];
- // Pobierz i sprawdź timeout z formularza
if (isset($_GET['timeout'])) {
$t = intval($_GET['timeout']);
- if ($t > 0 && $t <= 30) { // ograniczenie timeout do 30s
+ if ($t > 0 && $t <= 30) {
$timeout = $t;
}
}
+ if (isset($_GET['userAgent'])) {
+ $userAgent = $_GET['userAgent'];
+ }
+
+ if (isset($_GET['customUserAgent']) && trim($_GET['customUserAgent']) !== '') {
+ $customUserAgent = trim($_GET['customUserAgent']);
+ $userAgent = $customUserAgent;
+ } elseif (isset($_GET['userAgent']) && array_key_exists($_GET['userAgent'], $standardUserAgents)) {
+ $userAgent = $standardUserAgents[$_GET['userAgent']];
+ } else {
+ $userAgent = "PHP script"; // fallback
+ }
+
$opts = [
"http" => [
"method" => "GET",
"timeout" => $timeout,
- "header" => "User-Agent: PHP script\r\n"
+ "header" => "User-Agent: " . $userAgent . "\r\n"
]
];
$context = stream_context_create($opts);
@@ -62,9 +84,26 @@ if (isset($_GET['url']) && filter_var($_GET['url'], FILTER_VALIDATE_URL)) {
+
+
+
+
+
+
+
+
+
+