Created
December 31, 2019 15:59
-
-
Save kirilkirkov/bd26a2ee82fab05c2f2d3aa98232cab2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'https://valkata.lulin'; | |
$proxyList = ['186.47.82.6:41430', '43.240.5.1:31777', '202.166.201.65:23500']; | |
$browserAgents = [ | |
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7', | |
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', | |
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36', | |
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36', | |
]; | |
foreach($proxyList as $connection) { | |
$currentAgent = array_rand($browserAgents); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_PROXY, $connection); | |
// curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'user:password'); | |
// curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); | |
curl_setopt($ch, CURLOPT_USERAGENT, $browserAgents[$currentAgent]); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_HEADER, 1); | |
$curl_scraped_page = curl_exec($ch); | |
curl_close($ch); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment