Skip to content

Instantly share code, notes, and snippets.

@sarim
Created January 30, 2013 16:02
Show Gist options
  • Save sarim/4674261 to your computer and use it in GitHub Desktop.
Save sarim/4674261 to your computer and use it in GitHub Desktop.
parsing news ticker from bdnews24.com
<?php
$html = file_get_contents("http://bangla.bdnews24.com/");
$doc = new DOMDocument();
$doc->loadHTML($html);
$elements = $doc->getElementById("breaking")->getElementsByTagName("div")->item(0)->getElementsByTagName('a');
foreach ($elements as $element) {
$news = $element->nodeValue;
$newslink = $element->getAttribute('href');
//output $news and $newslink as you need. :)
echo $news . "\n" . $newslink . "\n";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment