daily pastebin goal
55%
SHARE
TWEET

bobohelpplease

a guest Jun 14th, 2018 61 in 145 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $url = "https://www.npr.org/rss/podcast.php?id=510318";
  3. $xml = simplexml_load_file($url);
  4. $items = $xml->channel->item;
  5. $feed = [
  6.                 'providerName'       => 'Paradigm',
  7.                 'lastUpdated'        => '',
  8.                 'language'                      => 'en_us',
  9.                 'series'         => [],
  10.         ];
  11. foreach($items as $item)
  12. {
  13. $title = $item->title;
  14. $feed['series'][] = [
  15.                         'title'          => $title,
  16.                 ];
  17.  
  18. }
  19.  
  20. header('Content-Type: application/json');
  21. echo json_encode($feed);
  22. ?>
  23.  
  24.  
  25. {"providerName":"Paradigm","lastUpdated":"","language":"en_us","series":[{"title":{"0":"Thursday, June 14th, 2018"}},{"title":{"0":"Wednesday, June 13th, 2018"}},{"title":{"0":"Tuesday, June 12th, 2018"}},{"title":{"0":"Monday, June 11th, 2018"}},{"title":{"0":"Friday, June 8th, 2018"}}]}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top