Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $rss_url = 'https://news.ycombinator.com/rss';
- $api_endpoint = 'https://api.rss2json.com/v1/api.json';
- $api_key = '00000000000000000000000000000000000000000';
- $params = http_build_query(array(
- 'rss_url'=>$rss_url,
- 'api_key'=>$api_key,
- 'count'=>5
- ));
- $data = json_decode( file_get_contents($api_endpoint . '?' . $params ) , true );
- if($data['status'] == 'ok'){
- echo "====== {$data['feed']['title']} ======\n";
- foreach ($data['items'] as $item) {
- echo "{$item['title']}\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement