Jump to content

quick simple retrive external xml (to cache on server)


knowj

Recommended Posts

I feel pretty stupid asking this but i need to retive xml data from an external source and include it into my cache script.

 

An easier way of putting it would be i need to display:

http://api.flickr.com/services/feeds/groups_discuss.gne?id=USERNO@DSD&lang=en-us&format=rss_200

as

http://www.myurl.com/flickerfeed.php

 

My minds just hitting a blank at the moment thanks in advance.

 

 

<?php
header("Content-Type: text/xml");
require_once '../includes/class_constants.php';
require_once '../includes/class_cache.php';
$cache = new cache(constants::CACHEDIR);
//start output buffer
ob_start();
//get cache data
$cache->get('flickr.txt', 86400);
//check the cache has loaded
if (!$cache->load())
{
	/* start content */
	//get file xml from here -> 'http://api.flickr.com/services/feeds/groups_discuss.gne?id=USERNO@DSD&lang=en-us&format=rss_200';
	/* end content */

	//load header into $header car
	$cache->newcache(ob_get_contents());
	//clean the output buffer
	ob_clean();
	//create the cache
	$cache->save('flickr.txt');
}
ob_end_clean();
echo $cache->export();
?>

Solved using:

 

<?php
header("Content-Type: text/xml");
require_once '../includes/class_constants.php';
require_once '../includes/class_cache.php';
$cache = new cache(constants::CACHEDIR);
//start output buffer
ob_start();
//get cache data
$cache->get('flickr.txt', 86400);
//check the cache has loaded
if (!$cache->load())
{
	/* start content */
	passthru("curl http://api.flickr.com/services/feeds/groups_pool.gne?id=USER@FSDF&lang=en-us&format=rss_200");
	/* end content */

	//load header into $header car
	$cache->newcache(ob_get_contents());
	//clean the output buffer
	ob_clean();
	//create the cache
	$cache->save('flickr.txt');
}
ob_end_clean();
echo $cache->export();
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.