Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "simple_html_dom.php";
- include "print_var.php";
- $url = "http://metodist.lbz.ru/communication/forum/forum29/?print=Y";
- $itemNum = 0;
- $themes;
- function get_web_page( $url ){
- $options = array(
- CURLOPT_RETURNTRANSFER => true, // return web page
- CURLOPT_HEADER => false, // don't return headers
- CURLOPT_FOLLOWLOCATION => true, // follow redirects
- CURLOPT_ENCODING => "", // handle all encodings
- CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17", // who am i
- CURLOPT_AUTOREFERER => true, // set referer on redirect
- CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
- CURLOPT_TIMEOUT => 120, // timeout on response
- CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
- );
- $ch = curl_init( $url );
- curl_setopt_array( $ch, $options );
- $content = curl_exec( $ch );
- $err = curl_errno( $ch );
- $errmsg = curl_error( $ch );
- $header = curl_getinfo( $ch );
- curl_close( $ch );
- $header['errno'] = $err;
- $header['errmsg'] = $errmsg;
- $header['content'] = $content;
- return $header['content'];
- }
- //var_dump( iconv('windows-1251', 'utf-8', get_web_page('http://metodist.lbz.ru/communication/forum/forum29/?print=Y') ));
- $pageLinks[] = $url;
- $html = file_get_html($url);
- foreach($html->find('div[class=forum-page-navigation]') as $element){
- foreach($element->find('a') as $link){
- if((in_array('http://metodist.lbz.ru'.$link->href, $pageLinks) == false) && is_string($link->href)){
- $pageLinks[] = 'http://metodist.lbz.ru'.$link->href;
- }
- }
- }// массив ссылок на все страницы форума
- unset($html);
- for($i =0; $i<count($pageLinks);$i++){
- //echo "<a href='".$pageLinks[$i]."'>lol</a><br>";
- //echo $pageLinks[$i].'<br>';
- $str = iconv('windows-1251', 'utf-8', get_web_page($pageLinks[$i]));
- echo $str;
- unset($str);
- }
- print_var($themes);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment