Guest User

Untitled

a guest
Mar 5th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. $PROXY_HOST = "10.10.20.30"; // Proxy server address
  2. $PROXY_PORT = "8080"; // Proxy server port
  3. $PROXY_USER = "myuser"; // Username
  4. $PROXY_PASS = "mypass"; // Password
  5.  
  6. $auth = base64_encode("$PROXY_USER:$PROXY_PASS");
  7. stream_context_set_default(
  8. array(
  9. 'http' => array(
  10. 'proxy' => "tcp://$PROXY_HOST:$PROXY_PORT",
  11. 'request_fulluri' => true,
  12. 'header' => "Proxy-Authorization: Basic $auth"
  13. )
  14. )
  15. );
  16.  
  17. $proxy = "10.10.20.30:8080";
  18. $useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
  19. $url = "https://www.google.com";
  20. $credentials = "myuser:mypass";
  21.  
  22. $ch = curl_init();
  23. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,15);
  24. curl_setopt($ch, CURLOPT_HTTP_VERSION,'CURL_HTTP_VERSION_1_1' );
  25. curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
  26. curl_setopt($ch, CURLOPT_PROXY, $proxy);
  27. curl_setopt($ch, CURLOPT_PROXYUSERPWD,$credentials);
  28. curl_setopt($ch, CURLOPT_USERAGENT,$useragent);
  29. curl_setopt($ch, CURLOPT_URL, $url);
  30. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
  31. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  32. curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
  33. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
  34. $result=curl_exec ($ch);
  35. curl_close ($ch);
  36.  
  37. echo 'RES: '.$result;
Add Comment
Please, Sign In to add comment