Displaying array from .txt file

Hi,

I’m making a LinkedIN “widget” that pulls your LinkedIN updates and displays them on a page. Unfortunately the page gets abit slobby when loading (because it needs to pull the rss feed and process it).
My plan to overcome this is to save the feed to an .txt file, and run a check on the file to see when it last was modified.

I’m stuck at the “pulling the data from the .txt”-part. I simply can get it to filter though the array in the .txt.

The .txt file

array ( 0 => array ( 'content' => SimpleXMLElement::__set_state(array( 0 => 'Jane Doe is now connected to John Doe (Marketing and Advertising Professional)', )), 'date' => 1320228279, 'link' => SimpleXMLElement::__set_state(array( 0 => 'http://www.linkedin.com', )), 'type' => 'linkedIN', ), 1 => array ( 'content' => SimpleXMLElement::__set_state(array( 0 => 'John Doe recommends In The Plex: How Google Thinks, Works, and Shapes Our Lives', )), 'date' => 1320188315, 'link' => SimpleXMLElement::__set_state(array( 0 => 'http://www.linkedin.com', )), 'type' => 'linkedIN', ), )

The PHP code

[php]
$data = file_get_contents(“cache.txt”);

foreach($data as $item)
{
echo $item[‘content’];
echo $item[‘type’];
echo $item[‘link’]
etc…
}

[/php]

This results in this warning: Warning: Invalid argument supplied for foreach()

Does anyone know what I am doing wrong, and maybe said someone can supply me with a working bit of code? :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service