Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $user_agent_array = file('proxy.txt');
- $reffer_array = array(
- 'http://yandex.ru',
- 'http://google.com'
- );
- $proxy_array = file('proxy.txt');
- function arrayRand($array) {
- return $array[mt_rand(0, count($array))];
- }
- function getContent($url) {
- GLOBAL $user_agent_array;
- GLOBAL $reffer_array;
- GLOBAL $proxy_array;
- $user_agent = trim(arrayRand($user_agent_array));
- $reffer = arrayRand($reffer_array);
- $proxy = trim(arrayRand($proxy_array));
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_REFERER, $reffer);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $_SERVER['DOCUMENT_ROOT'].'/cookie.txt'); //сохранить куки в файл
- curl_setopt ($ch, CURLOPT_COOKIEFILE, $_SERVER['DOCUMENT_ROOT'].'/cookie.txt'); //считать куки из файла
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 7); //тайм-аут соединения
- curl_setopt($ch, CURLOPT_TIMEOUT, 7);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); //возврат необработанного ответа
- curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
- curl_setopt($ch, CURLOPT_PROXY, $proxy);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //переходить по редиректам
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);// не проверять SSL сертификат
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);// не проверять Host SSL сертификата
- $content = curl_exec($ch);
- }
- echo getContent('http://gadarutym.ru/3/good.php');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement