Validating proxy via PHP

Validating proxy via PHP

This is how we use and curl to validate any proxy simply you pass the url with IP and port number and results will be printed immediately.

In PHP we have to request a given URL via the proxy and see if it will respond with the expected result.
   
 
First on box debian based you need to run the following command to instal 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
# http://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<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.

 


 

Digiprove sealCopyright protected by Digiprove © 2014 Eagle Eye Digital Solutions
JOIN OUR NEWSLETTER
Amazing people have subscribed to our newsletter — and you’re amazing too!
We hate spam. Your email address will not be sold or shared with anyone else.
The following two tabs change content below.
Warith Al Maawali
W. AL Maawali is the Founder and Chief Editor of Eagle Eye Digital Solutions from the Sultanate of Oman with over 20 years experience in Security and Digital Forensics. He is also the Founder of om77.net.
PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.
Linux is, in simplest terms, an operating system. It is the software on a computer that enables applications and the computer operator to access the devices on the computer to perform desired functions. The operating system (OS) relays instructions from an application to, for instance, the computer’s processor.

4 comments

  1. Line 34, there is a problem, “,” should not be there.

    • Dear Shin,

      You can use . or , in echo with php both are fine it would be wrong if I use , in return statement

      echo is a language construct (not a function) and can take multiple arguments, that’s why , works. using comma will be slightly even (but only some nanoseconds, nothing to worry about)

      The above code is tested and runs fine on our nodes.

  2. One of the most simple code outs that have seen; respect!

commentJoin the Discussion

Pin It on Pinterest