PHPBuilder - Validating Incoming Clients for Anonymous Proxy Us Page 3



RSS Twitter
Articles Application Architecture

Validating Incoming Clients for Anonymous Proxy Us - Page 3

by: Gaddo F. Benedetti
|
December 19, 2002

You'll note I've defined my ports as an array, so that I may loop through them when attempting to connect thus:

<?php
    
foreach ($Ports as $Port){
        
$fp fsockopen($IP$Port$errno$errstr$Timeout);
?>
If we don't get an error straight away, we send our request. You'll note that some of the headers are slightly different to your standard HTTP request, in that first of all we include the full URL and not just the file path in the GET and add Host and Proxy-Connection headers to the request.

<?php
        
if ($errno == ) {
            
$FPut "GET http://".$URL."/ HTTP/1.0\r\n";
            
$FPut .= "Proxy-Connection: Keep-Alive\r\n";
            
$FPut .= "Pragma: no-cache\r\n";
            
$FPut .= "Host: ".$URL."\r\n";
            
$FPut .= "User-Agent: Proxy-Validator\r\n";
            
$FPut .= "\r\n";
            
fputs($fp$FPut);
            
$HTTP_Response fgets($fp128);
            if(
strlen(stristr($HTTP_Response"200")) > 0){
                
$bOpenProxy true;
            }
            
fclose($fp);
        }
?>

« Previous Page
1
|
2
|
3
|
4
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Gaddo F. Benedetti

Comment:



Comment:

(Maximum characters: 1200). You have characters left.