With the help of CHADGTP
- Fetches Proxies From Github Raw Lists
- Removes Duplicates
- Writes The Proxies To Files
- Hosts The Lists On Localhost
<?php
// Define the URLs to scrape proxies from
$urls = [
'http' => [
'https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/http.txt',
'https://raw.githubusercontent.com/ErcinDedeoglu/proxies/main/proxies/http.txt',
'https://raw.githubusercontent.com/TheSpeedX/SOCKS-List/master/http.txt',
'https://raw.githubusercontent.com/mmpx12/proxy-list/master/http.txt',
'https://raw.githubusercontent.com/ErcinDedeoglu/proxies/main/proxies/https.txt',
'https://raw.githubusercontent.com/mmpx12/proxy-list/master/https.txt',
'https://raw.githubusercontent.com/MuRongPIG/Proxy-Master/main/http.txt',
'https://raw.githubusercontent.com/zevtyardt/proxy-list/main/http.txt',
'https://raw.githubusercontent.com/ALIILAPRO/Proxy/main/http.txt',
'https://sunny9577.github.io/proxy-scraper/generated/http_proxies.txt'
],
'socks4' => [
'https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/socks4.txt',
'https://raw.githubusercontent.com/ErcinDedeoglu/proxies/main/proxies/socks4.txt',
'https://raw.githubusercontent.com/TheSpeedX/SOCKS-List/master/socks4.txt',
'https://raw.githubusercontent.com/mmpx12/proxy-list/master/socks4.txt',
'https://raw.githubusercontent.com/MuRongPIG/Proxy-Master/main/socks4.txt',
'https://raw.githubusercontent.com/zevtyardt/proxy-list/main/socks4.txt',
'https://raw.githubusercontent.com/ALIILAPRO/Proxy/main/socks4.txt',
'https://sunny9577.github.io/proxy-scraper/generated/socks4_proxies.txt'
],
'socks5' => [
'https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/socks5.txt',
'https://raw.githubusercontent.com/ErcinDedeoglu/proxies/main/proxies/socks5.txt',
'https://raw.githubusercontent.com/mmpx12/proxy-list/master/socks5.txt',
'https://raw.githubusercontent.com/TheSpeedX/SOCKS-List/master/socks5.txt',
'https://raw.githubusercontent.com/hookzof/socks5_list/master/proxy.txt',
'https://raw.githubusercontent.com/MuRongPIG/Proxy-Master/main/socks5.txt',
'https://raw.githubusercontent.com/zevtyardt/proxy-list/main/socks5.txt',
'https://raw.githubusercontent.com/ALIILAPRO/Proxy/main/socks5.txt',
'https://sunny9577.github.io/proxy-scraper/generated/socks5_proxies.txt'
]
];
// Function to fetch proxies from a URL
function fetch_proxies($url) {
$proxies = file_get_contents($url);
return explode("\n", $proxies);
}
// Function to write proxies to a file
function write_proxies($filename, $proxies) {
file_put_contents($filename, implode("\n", $proxies));
}
// Function to remove duplicates
function remove_duplicates($proxies) {
return array_unique(array_filter($proxies));
}
// Arrays to hold proxies
$http_proxies = [];
$socks4_proxies = [];
$socks5_proxies = [];
// Fetch and process proxies
foreach ($urls as $type => $url_list) {
$all_proxies = [];
foreach ($url_list as $url) {
$proxies = fetch_proxies($url);
$all_proxies = array_merge($all_proxies, $proxies);
}
$all_proxies = remove_duplicates($all_proxies);
if ($type == 'http') {
$http_proxies = $all_proxies;
} elseif ($type == 'socks4') {
$socks4_proxies = $all_proxies;
} elseif ($type == 'socks5') {
$socks5_proxies = $all_proxies;
}
}
// Write proxies to files
write_proxies('http.txt', $http_proxies);
write_proxies('socks4.txt', $socks4_proxies);
write_proxies('socks5.txt', $socks5_proxies);
echo "Proxies have been fetched and written to files successfully.";
?>
Step-by-Step Guide for Server Setup and Script Execution
-
Download and Install XAMPP:
- Go to the XAMPP website.
- Download the version suitable for your operating system (Windows, Linux, macOS).
- Follow the installation instructions.
-
Start XAMPP:
- Launch XAMPP Control Panel.
- Start the Apache module by clicking “Start” next to Apache.
-
Prepare Your PHP Script:
- Open a text editor (like Notepad++ or Visual Studio Code).
- Copy the PHP script above into the editor.
- Save the file as
scrape_proxies.php
in thehtdocs
directory of your XAMPP installation (e.g.,C:\xampp\htdocs\
on Windows,/Applications/XAMPP/htdocs/
on macOS).
-
Run the PHP Script:
- Open your web browser.
- Navigate to
http://localhost/scrape_proxies.php
. - The script will fetch proxies, check them, remove duplicates, and write the valid ones to
http.txt
,socks4.txt
, andsocks5.txt
.
-
Access the Proxy Lists:
- HTTP proxies:
http://localhost/http.txt
. - SOCKS4 proxies:
http://localhost/socks4.txt
. - SOCKS5 proxies:
http://localhost/socks5.txt
.
- HTTP proxies:
All Credits to ChatGpt.