Created
September 12, 2012 03:16
-
-
Save firedfox/3704062 to your computer and use it in GitHub Desktop.
get blogs from hi.baidu.com
This file contains 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
<?php | |
require('simple_html_dom.php'); | |
$html = file_get_html('http://hi.baidu.com/new/bdtongji'); | |
foreach($html->find('article') as $element) { | |
$day = $element->find('.q-day', 0)->plaintext; | |
$monthYear = $element->find('.q-month-year', 0)->plaintext; | |
if (!is_null($day) && !is_null($monthYear)) { | |
$title = $element->find('.a-title', 0)->plaintext; | |
echo $day . '/' . $monthYear . ':' . $title . '<br />'; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment