-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32595fd
commit f12fc18
Showing
2 changed files
with
680 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
include __dir__.'/../vendor/autoload.php'; | ||
|
||
function file_cache_content( $url ) { | ||
$file = __dir__.'/data/'.md5( $url ); | ||
if( file_exists( $file ) ) | ||
return file_get_contents( $file ); | ||
file_put_contents( $file, $c = file_get_contents( $url ) ); | ||
return $c; | ||
} | ||
|
||
$p = new \Pejman\DomParser\Parser( file_cache_content('http://feeds.bbci.co.uk/news/stories/rss.xml') ); | ||
|
||
foreach( $p->find("channel item") as $item ) { | ||
echo $item->find("title",0)->html()."\n"; | ||
} |
Oops, something went wrong.