Created
January 18, 2016 19:12
-
-
Save VictorFursa/061c72dff92859e10806 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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| <html xmlns="http://www.w3.org/1999/xhtml" lang="ru" xml:lang="ru"> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=UTF-8" /> | |
| <?php | |
| $urlOut = 'https://www.avito.ru/profile'; // Куда данные послать | |
| $urlTo = 'https://www.avito.ru/profile/lDDDDDDDDDD?next=%2Fprofile'; // Куда данные послать | |
| $login = 'Zir4onah'; // Логин | |
| $password = '540919'; // Пароль | |
| $auth = 'login='.$login.'&password='.$password; // POST данные | |
| $ch = curl_init(); // Инициализация сеанса | |
| curl_setopt($ch, CURLOPT_URL, $urlTo); | |
| curl_setopt($ch, CURLOPT_HEADER, 1); // получать заголовки | |
| curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,30); | |
| curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36'); | |
| curl_setopt($ch, CURLOPT_REFERER, 'http://www.avito.ru'); | |
| curl_setopt($ch, CURLOPT_POST,1); | |
| curl_setopt($ch, CURLOPT_COOKIEJAR,$_SERVER['DOCUMENT_ROOT'].'/1.txt'); | |
| curl_setopt($ch, CURLOPT_POSTFIELDS, $auth); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); | |
| curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Говорим скрипту, чтобы он следовал за редиректами которые происходят во время авторизации | |
| curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
| curl_setopt ($ch, CURLOPT_HTTPHEADER, array('Expect:')); // это необходимо, чтобы cURL не высылал заголовок на ожидание | |
| $result = curl_exec($ch); | |
| curl_setopt($ch, CURLOPT_URL, $urlOut); | |
| curl_setopt($ch, CURLOPT_HEADER, 0); // получать заголовки | |
| curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,30); | |
| curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36'); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); | |
| curl_setopt($ch, CURLOPT_COOKIEFILE,$_SERVER['DOCUMENT_ROOT'].'/1.txt'); | |
| curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Говорим скрипту, чтобы он следовал за редиректами которые происходят во время авторизации | |
| curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
| $result = curl_exec($ch); // Забираем страницу | |
| curl_close($ch); // Завершаем сеанс | |
| ?> | |
| </head> | |
| <body> | |
| <?php echo $result; // Оказываемся в вашем аккаунте ?> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment