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

Replace 'Proxy_IP_Address' and 'Proxy_Port' with the actual IP address and port of the proxy you want to test. This script sends a request to a specified URL through the proxy and checks if the response code is 200 OK. If there’s any error or the response code is different from 200, it indicates that the proxy may not be working properly.

Comments (0)

There are no comments here yet, you can be the first!

Leave a Reply

Your email address will not be published. Required fields are marked *


Choose and Buy Proxy

Datacenter Proxies

Rotating Proxies

UDP Proxies

Trusted By 10000+ Customers Worldwide

Proxy Customer
Proxy Customer
Proxy Customer flowch.ai
Proxy Customer
Proxy Customer
Proxy Customer