Php collects remote articles and jumps to the simple class
Db = $ db;} function geturlfile ($ url) {$ url = trim ($ url); $ content = ''; if (extension_loaded ('curl ')) {$ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, $ url); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt ($ ch, CURLOPT_HEADER, 0); $ content = curl_exec ($ ch); curl_close ($ ch);} else {$ content = file_get_contents ($ url );} return trim ($ content) ;} Function get_all_url ($ code) {preg_match_all ('/"\'] +) [" | \ ']? \ S * [^>] *> ([^>] +)/is ', $ code, $ arr ); return array ('name' => $ arr [2], 'URL' => $ arr [1]);} function get_sub_content ($ str, $ start, $ end) {$ start = trim ($ start); $ end = trim ($ end); if ($ start = ''| $ end = '') {return $ str ;}$ str = explode ($ start, $ str); $ str = explode ($ end, $ str [1]); return $ str [0];} function vd ($ var) {echo "\ r \ n"; echo "\ r \ n"; var_dump ($ var ); echo "\ r \ n"; echo "" ;}}?> Geturlfile ($ url); // defines the collection list range $ start = ''; $ end = ''; // Obtain the article URL and TITLE $ code = $ gather-> get_sub_content ($ html, $ start, $ end) in the interval ); $ newsAry = $ gather-> get_all_url ($ code); // print the result // $ gather-> vd ($ newsAry ); $ tarGetUrl = $ newsAry ['URL'] [0]; // Obtain the target url HTML $ html = $ gather-> geturlfile ($ tarGetUrl ); // define the collection list range $ start = ''; $ end =''; // Obtain the article URL and TITLE $ code = $ gather-> get_sub_content ($ html, $ start, $ end); $ killHtml = ''; $ kill Html2 = ''; $ code = str_replace ($ killHtml," ", $ code); $ code = str_replace ($ killHtml2," ", $ code ); $ gather-> vd ($ code);?>