Advertisement
TheRockettek

Proxy

Apr 12th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. <?php
  2.  
  3. $url = $_GET['url'];
  4.  
  5. if(!function_exists('getallheaders'))
  6. {
  7.  function getallheaders()
  8.  {
  9.   foreach($_SERVER as $name => $value)
  10.   {
  11.    if(substr($name, 0, 5) == 'HTTP_')
  12.    {
  13.     $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
  14.    }
  15.   }
  16.   return $headers;
  17.  }
  18. }
  19.  
  20.  
  21. $headers = getallheaders();
  22.  
  23. foreach($headers as $HeaderType=>$HeaderValue) {
  24.   if ( substr($HeaderType,0,3) == "123" ) {
  25.     $new = substr($HeaderType,3,strlen($HeaderType));
  26.     $formatted = strtoupper(substr($new,0,1)) . substr($new,1,strlen($new));
  27.     $headers[$formatted] = $HeaderValue;
  28.     unset($headers[$HeaderType]);
  29.   }
  30. }
  31.  
  32. if ( !$url ) {
  33.   die("No url");
  34. } else {
  35.   $ch = curl_init( $url );
  36.   if ( strtolower($_SERVER['REQUEST_METHOD']) == 'post' ) {
  37.     curl_setopt( $ch, CURLOPT_POST, true );
  38.     curl_setopt( $ch, CURLOPT_POSTFIELDS, $_POST );
  39.   }
  40.   curl_setopt( $ch, CURLOPT_URL, $url);
  41.   curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
  42.   $contents = curl_exec( $ch );
  43.   curl_close( $ch );
  44. }
  45.  
  46. print substr($contents,1,strlen($content)-1);
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement