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

Sostituire 'Proxy_IP_Address' e 'Proxy_Port' con l'indirizzo IP e la porta effettivi del proxy che desideri testare. Questo script invia una richiesta a un URL specificato tramite il proxy e controlla se il codice di risposta lo è 200 OK. Se si verifica un errore o il codice di risposta è diverso da 200, indica che il proxy potrebbe non funzionare correttamente.

Commenti (0)

Non ci sono ancora commenti qui, puoi essere il primo!

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *


Scegliere e acquistare il Proxy

Proxy per data center

Proxy a rotazione

Proxy UDP

Scelto da oltre 10.000 clienti in tutto il mondo

Cliente proxy
Cliente proxy
Cliente proxy flowch.ai
Cliente proxy
Cliente proxy
Cliente proxy