Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL | E_STRICT);
- ini_set('display_errors', TRUE);
- ini_set('display_startup_errors', TRUE);
- header('Content-type: text/html; charset=UTF-8');
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title></title>
- </head>
- <body>
- <?php
- if (isset($_POST['add'])) {
- $url_array = strip_tags(trim($_POST['text']));
- $url_array = explode("\n", $url_array);
- // Список прокси
- // http://foxtools.ru/Proxy
- $proxy = '31.28.23.219:8118';
- foreach ($url_array as $url_link) {
- $url_link = trim($url_link);
- if ($url_link) {
- $main = curl_init($url_link);
- //шлем заголовки
- //теперь curl вернет нам ответ, а не выведет
- curl_setopt($main, CURLOPT_RETURNTRANSFER, 1);
- // ставим браузер
- curl_setopt($main, CURLOPT_USERAGENT, 'Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.7.62 Version/11.01');
- // разрешаем перенаправление на полученный в заголовке URL
- curl_setopt($main, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($main, CURLOPT_COOKIEFILE, "cookie.txt");
- curl_setopt($main, CURLOPT_COOKIEJAR, "cookie.txt");
- // ставим прокси
- curl_setopt($main, CURLOPT_PROXY, $proxy);
- if ($main) {
- // Выполняем запрос и приводим к одной кодировке
- $html = curl_exec($main);
- // Посмотрим что скачалось
- echo $html;
- } else {
- echo "curl_init failure! <br/>\r\n";
- }
- curl_close($main);
- }
- }
- }
- ?>
- <form action="" method="POST">
- <textarea name="text">http://yandex.ru/</textarea>
- <button type="submit" name="add">Add</button>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement