-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverproxy
More file actions
36 lines (25 loc) · 997 Bytes
/
serverproxy
File metadata and controls
36 lines (25 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
// URL of the website to scrape
$url = "https://trafficnow.xyz/ghostproxy.txt";
// Fetch the contents of the webpage
$html = file_get_contents($url);
// Regular expression pattern to match server host:port pairs
$pattern = '/(\b(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}\b:\d+)/';
// Match server host:port pairs in the HTML content
preg_match_all($pattern, $html, $matches);
// Get unique server list
$servers = array_unique($matches[0]);
// Generate PAC file content
$pacContent = "function FindProxyForURL(url, host) {\n";
$pacContent .= " var server = ";
// Select a random server from the list
$randomIndex = array_rand($servers);
$randomServer = $servers[$randomIndex];
$pacContent .= "'HTTPS $randomServer';\n";
$pacContent .= " return server;\n";
$pacContent .= "}\n";
// Output the PAC content
header("Content-Type: application/x-ns-proxy-autoconfig");
header("Content-Disposition: attachment; filename=servers.pac");
echo $pacContent;
?>