<?php
// Set the proxy IP address and port
$proxyIP = 'Proxy_IP_Address';
$proxyPort = 'Proxy_Port';
// URL to test the proxy
$url = 'http://example.com';
// Set timeout for the request
$timeout = 10;
// Initialize cURL session
$ch = curl_init();
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxyIP . ':' . $proxyPort);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// Execute cURL request
$response = curl_exec($ch);
// Check if any error occurred
if(curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
} else {
// Get HTTP response code
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// Check if request was successful (HTTP 200)
if($httpCode == 200) {
echo 'Proxy is working!';
} else {
echo 'Proxy is not working. HTTP Response Code: ' . $httpCode;
}
}
// Close cURL session
curl_close($ch);
?>
Gantikan 'Proxy_IP_Address'
dan 'Proxy_Port'
dengan alamat IP sebenar dan port proksi yang anda ingin uji. Skrip ini menghantar permintaan ke URL tertentu melalui proksi dan menyemak sama ada kod respons itu 200 OK
. Jika terdapat sebarang ralat atau kod respons berbeza daripada 200
, ini menunjukkan bahawa proksi mungkin tidak berfungsi dengan betul.
Komen (0)
Tiada ulasan di sini lagi, anda boleh menjadi yang pertama!