|
1 | 1 | <?php |
2 | 2 | include_once 'simple_html_dom.php'; |
3 | 3 |
|
4 | | -$curl = curl_init('http://forumodua.com/showthread.php?t=851487'); |
| 4 | +$curl = curl_init('http://forumodua.com/'); |
5 | 5 |
|
6 | 6 | curl_setopt($curl, CURLOPT_FRESH_CONNECT, true); |
7 | 7 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
|
18 | 18 |
|
19 | 19 | $html = str_get_html($result); |
20 | 20 |
|
| 21 | +/** @var simple_html_dom_node $form */ |
| 22 | +$form = $html->find('#navbar_loginform', 0); |
| 23 | +$action = $form->attr['action']; |
| 24 | + |
| 25 | +$curl = curl_init('http://forumodua.com/'.$action); |
| 26 | +curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
| 27 | +curl_setopt($curl, CURLOPT_COOKIESESSION, false); |
| 28 | +curl_setopt($curl, CURLOPT_POST, true); |
| 29 | +curl_setopt($curl, CURLOPT_HEADER, true); |
| 30 | +curl_setopt($curl, CURLOPT_POSTFIELDS, [ |
| 31 | + 'vb_login_username' => 'K@R@NTiN', |
| 32 | + 'vb_login_md5password' => md5('100891'), |
| 33 | + 'vb_login_md5password_utf' => md5('100891'), |
| 34 | + 'securitytoken' => 'guest', |
| 35 | + 'cookieuser' => 1, |
| 36 | + 'do' => 'login', |
| 37 | + 'vb_login_password' => '' |
| 38 | +]); |
| 39 | +curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'); |
| 40 | +curl_setopt($curl, CURLOPT_HTTPHEADER, [ |
| 41 | + "Content-Type: text/xml; charset=utf-8", |
| 42 | + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", |
| 43 | + "Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7,uk;q=0.6" |
| 44 | +]); |
| 45 | + |
| 46 | +$result = curl_exec($curl); |
| 47 | + |
| 48 | +preg_match_all('/Set-Cookie:\s*([^;]*)/', $result, $matches); |
| 49 | + |
| 50 | +$cookies = ''; |
| 51 | + |
| 52 | +foreach($matches[1] as $item) { |
| 53 | + $cookies .= $cookies ? '; '.$item : $item; |
| 54 | +} |
| 55 | + |
| 56 | +curl_setopt($curl, CURLOPT_URL, 'http://forumodua.com/showthread.php?t=851487'); |
| 57 | +curl_setopt($curl, CURLOPT_HTTPGET, true); |
| 58 | +curl_setopt($curl, CURLOPT_COOKIESESSION, false); |
| 59 | +curl_setopt($curl, CURLOPT_COOKIE, $cookies); |
| 60 | + |
| 61 | +$result = curl_exec($curl); |
| 62 | + |
| 63 | +curl_close($curl); |
| 64 | + |
| 65 | +$html = str_get_html($result); |
| 66 | + |
21 | 67 | $messages = $html->find('.postbitlegacy'); |
22 | 68 | $theme = $html->find('title', 0)->text(); |
23 | 69 | $folder = __DIR__.DIRECTORY_SEPARATOR.'posts'; |
|
0 commit comments