Skip to content

Instantly share code, notes, and snippets.

@alexkharlamov
alexkharlamov / curl_pia.php
Created July 14, 2017 00:40
Scrape a website using Private Internet Access
$curl = curl_init();
$url = 'http://www.url_you_want_to_scrape.com';
$username = 'username'; // substitute your PIA PPTP/L2TP/SOCKS username (different from regular PIA username)
$password = 'password'; // substitute your PIA PPTP/L2TP/SOCKS password (different from regular PIA password)
$pia_url = 'proxy-nl.privateinternetaccess.com:1080'; // current one should be here: https://helpdesk.privateinternetaccess.com/hc/en-us/articles/236265587-Can-I-Use-SOCKS5-
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url,
CURLOPT_PROXYTYPE => CURLPROXY_SOCKS5,
CURLOPT_PROXY => 'socks5://' . $username . ':' . $password . '@' . $pia_url,