Created
January 30, 2013 16:02
-
-
Save sarim/4674261 to your computer and use it in GitHub Desktop.
parsing news ticker from bdnews24.com
This file contains hidden or 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 | |
$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