Advertisement
Guest User

Untitled

a guest
Aug 28th, 2016
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. sudo htpasswd /etc/squid3/squid_passwd myusername
  2.  
  3. auth_param basic program /usr/lib/squid3/ncsa_auth /etc/squid3/squid_passwd
  4. auth_param basic credentialsttl 2 hours
  5. auth_param basic casesensitive off
  6. acl ncsa_users proxy_auth REQUIRED
  7. http_access allow ncsa_users
  8.  
  9. /usr/lib/squid3/ncsa_auth /et/squid3/squid_passwd
  10. myusername password
  11. OK
  12.  
  13. $proxy = "111.11.11.11:8220"; // my squid ip and port
  14. $proxyauth = base64_encode('username:pass'); // Tried without base64_encode also
  15. $ch = curl_init();
  16. curl_setopt($ch, CURLOPT_URL,$url);
  17. curl_setopt($ch, CURLOPT_PROXY, $proxy);
  18. curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
  19. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  20. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  21. curl_setopt($ch, CURLOPT_HEADER, 1);
  22. $curl_scraped_page = curl_exec($ch);
  23. echo $curl_scraped_page;
  24. if(curl_error($ch))
  25. {
  26. echo 'error:' . curl_error($ch);
  27.  
  28. }
  29. curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement