Warith AL Maawali

0 %
Warith AL Maawali
Driving cybersecurity excellence
Innovator behind Linux Kodachi
  • Residence:
    127.0.0.1
  • Uptime Binary:
    101110
  • Mantra:
    Innovate, Secure, Repeat
ONS
EEDS
NSSG
Visual basic
Delphi
Gambas
Bash
PHP
  • Infrastructures
  • Digital Forensics
  • Cryptocurrency
  • Cloud & Server Management

Validating proxy via PHP

01/05/2014

This is how we use PHP and cURL to validate any proxy. Simply pass the URL with the IP and port number, and the results will be printed immediately. In PHP, we request a given URL via the proxy and check if it responds with the expected result.

First, on a Debian-based Linux box, you need to run the following command to install php-curl:

sudo apt-get install php5-curl

Curl request code:

<!--?php 
/* PHP script written by W. Al Maawali  
# (c) 2014 Founder of Eagle Eye Digital Solutions
# https://www.digi77.com
# http://www.om77.net
# script starts here:*/



//pass IP and Port via URL
$theIP=$_GET["ip"];
$thePort=$_GET["port"];
$passByIPPort= $_GET["ip"] . ":" . $_GET["port"];


// You can use any web site here to show you real ip such as http://whatismyipaddress.com/
$url = "https://www.digi77.com/software/bouncer/data/myipvv-by-web.php";

// Get current time to check proxy speed
$loadingtime = time();

$theHeader = curl_init($url);
curl_setopt($theHeader, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($theHeader, CURLOPT_TIMEOUT, 20);
curl_setopt($theHeader, CURLOPT_PROXY, $passByIPPort); 

//Execute the request
$curlResponse = curl_exec($theHeader);



if ($curlResponse === false) 
{
    echo "Proxy is not working: ", curl_error($theHeader);
} 
else 
{
    //print the output
    echo $curlResponse;
    // Get Proxy speed speed
    echo "Proxy speed: " . (time() - $loadingtime) . "s&lt;br ?-->\n";
}// end if



?>

 

Download

  On the other node we will wait for the proxy request to be received and executed the code is small. 

Display ip on a different node code: 

<!--?php

echo  "Proxy is up and working :).<br /-->\n" . " The IP address we found from your request is: "  . getenv("REMOTE_ADDR") ."<br>\n" ;

?

 
Demo of this code can be seen here:

http://fpnl1.digi77.com/proxychecker.php?ip=124.248.211.170&port=3128

  
Those were the easy steps to validate a proxy via php if you are looking for an advance multi proxy validator then we have a free tool try it E-Bouncer project. 


 

Posted in Tech BlogTags:
© 2024 Warith AL Maawali. All Rights Reserved.
Stay Secure, Stay Assured.