$latestDate) $latestDate = strtotime($item['updated']); } $lastBuildDate = date(DATE_RSS, $latestDate); //Create the RSS feed $xmlFeed = new SimpleXMLElement(''); $xmlFeed->addChild("channel"); //Required elements $xmlFeed->channel->addChild("title", 'PeeringDB: The 50 most recently created facilities'); $xmlFeed->channel->addChild("pubDate", $lastBuildDate); $xmlFeed->channel->addChild("lastBuildDate", $lastBuildDate); //Optional elements if (isset($jf['description'])) $xmlFeed->channel->description = $jf['description']; if (isset($jf['home_page_url'])) $xmlFeed->channel->link = $jf['home_page_url']; //Items foreach ($jf['data'] as $item) { $newItem = $xmlFeed->channel->addChild('item'); //Standard stuff if (isset($item['id'])) $newItem->addChild('guid', $item['id']); if (isset($item['name'])) $newItem->addChild('title', $item['name'].' - '.$item['org_name']); if (isset($item['content_text'])) $newItem->addChild('description', $item['address1'].$item['city'].$item['country']); if (isset($item['created'])) $newItem->addChild('pubDate', $item['created']); if (isset($item['website'])) $newItem->addChild('link', 'https://www.peeringdb.com/fac/'.$item['id']); //Enclosures? if(isset($item['attachments'])) { foreach($item['attachments'] as $attachment) { $enclosure = $newItem->addChild('enclosure'); $enclosure['url'] = $attachment['url']; $enclosure['type'] = $attachment['mime_type']; $enclosure['length'] = $attachment['size_in_bytes']; } } } //Make the output pretty $dom = new DOMDocument("1.0"); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->loadXML($xmlFeed->asXML()); return $dom->saveXML(); } $content = @file_get_contents("https://www.peeringdb.com/api/fac"); $content = json_decode($content, true); $content = $content['data']; $content = count($content); $content = $content-50; $content = @file_get_contents("https://www.peeringdb.com/api/fac?skip=$content"); $content = json_decode($content, true); //$content = $content['data']; echo (convert_jsonfeed_to_rss($content));