<?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);
?>

更换 'Proxy_IP_Address''Proxy_Port' 替换为要测试的代理的实际 IP 地址和端口。此脚本通过代理向指定 URL 发送请求,并检查响应代码是否 200 OK。如果发生任何错误或响应代码不同于 200,则表明代理可能无法正常工作。

评论 (0)

这里还没有评论,你可以成为第一个评论者!

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注


选择和购买代理

数据中心代理

轮流代理

UDP代理机构

受到全球 10000 多家客户的信赖

代理客户
代理客户
代理客户 flowch.ai
代理客户
代理客户
代理客户