Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $PROXY_HOST = "10.10.20.30"; // Proxy server address
- $PROXY_PORT = "8080"; // Proxy server port
- $PROXY_USER = "myuser"; // Username
- $PROXY_PASS = "mypass"; // Password
- $auth = base64_encode("$PROXY_USER:$PROXY_PASS");
- stream_context_set_default(
- array(
- 'http' => array(
- 'proxy' => "tcp://$PROXY_HOST:$PROXY_PORT",
- 'request_fulluri' => true,
- 'header' => "Proxy-Authorization: Basic $auth"
- )
- )
- );
- $proxy = "10.10.20.30:8080";
- $useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
- $url = "https://www.google.com";
- $credentials = "myuser:mypass";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,15);
- curl_setopt($ch, CURLOPT_HTTP_VERSION,'CURL_HTTP_VERSION_1_1' );
- curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
- curl_setopt($ch, CURLOPT_PROXY, $proxy);
- curl_setopt($ch, CURLOPT_PROXYUSERPWD,$credentials);
- curl_setopt($ch, CURLOPT_USERAGENT,$useragent);
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
- $result=curl_exec ($ch);
- curl_close ($ch);
- echo 'RES: '.$result;
Add Comment
Please, Sign In to add comment