Skip to content

Instantly share code, notes, and snippets.

@firedfox
Created September 12, 2012 03:16
Show Gist options
  • Save firedfox/3704062 to your computer and use it in GitHub Desktop.
Save firedfox/3704062 to your computer and use it in GitHub Desktop.
get blogs from hi.baidu.com
<?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