Created
June 30, 2018 13:11
-
-
Save Ashkanph/9eb3dfca6a46b2ea9c13c8b7955c3ba4 to your computer and use it in GitHub Desktop.
My PHP proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL); | |
ini_set("display_errors", 1); | |
//$ch = curl_init($_GET['url']); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |
curl_setopt($ch, CURLOPT_VERBOSE, TRUE); | |
//echo "http://185.162.235.142:80/".$_GET['url']; | |
//curl_setopt($ch, CURLOPT_PROXY, "http://999.999.999.999:2000"); //your proxy url | |
//curl_setopt($ch, CURLOPT_PROXYPORT, "2000"); // your proxy port number | |
//curl_setopt($ch, CURLOPT_URL, "http://999.999.999.999/api/v1/category"); | |
// curl_setopt($ch, CURLOPT_URL, "http://999.999.999.999.3"); | |
curl_setopt($ch, CURLOPT_URL, "http://999.999.999.999:80/".$_GET['url']); | |
// curl_setopt($ch, CURLOPT_PORT, 2040); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | |
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-type: application/vnd+cbnv+endpoint']); | |
$output = curl_exec($ch); | |
//$info = curl_getinfo($ch); | |
//var_dump($info); | |
//var_dump(curl_error($ch)); | |
curl_close($ch); | |
echo $output; | |
//echo function_exists('curl_exec'); | |
//echo extension_loaded('curl'); | |
/* | |
echo '<pre>'; | |
var_dump(curl_version()); | |
echo '</pre>'; | |
*/ | |
/* | |
// To check if ports are open | |
//$host = 'http://999.999.999.999/api/v1/category'; | |
$host = 'egovahi.ir'; | |
$ports = array(88, 21, 25, 80, 81, 110, 443, 3306, 2000); | |
foreach ($ports as $port) | |
{ | |
$connection = @fsockopen($host, $port); | |
if (is_resource($connection)) | |
{ | |
echo '<h2>' . $host . ':' . $port . ' ' . '(' . getservbyport($port, 'tcp') . ') is open.</h2>' . "\n"; | |
fclose($connection); | |
} | |
else | |
{ | |
echo '<h2>' . $host . ':' . $port . ' is not responding.</h2>' . "\n"; | |
} | |
} | |
*/ | |
//echo file_get_contents("http://999.999.999.999/".$_GET['url']); | |
/* | |
$fp = fsockopen('999.999.999.999:2000/api/v1', 2000, $errno, $errstr, 5); | |
if (!$fp) { | |
echo "port is closed or blocked"; | |
} else { | |
echo "port is open and available"; | |
fclose($fp); | |
}*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment