Visa ett inlägg
Oläst 2010-04-19, 11:53 #1
lerkan69 lerkan69 är inte uppkopplad
Nykomling
 
Reg.datum: Dec 2007
Inlägg: 31
lerkan69 lerkan69 är inte uppkopplad
Nykomling
 
Reg.datum: Dec 2007
Inlägg: 31
Standard Dra ut bilder ur RSS flöde (PHP)

Hej, jag håller på att göra en kod som importerar rss-flöden. Jag har inga problem att få ut titeln, datumet, description, etc... men jag lyckas inte få ut bilden. Är det någon som vet hur man gör detta?

Tack på förhand!

Så här ser koden ut:

foreach ($feeds as $feed) {

//load feed into xml element
$rss = simplexml_load_file($feed["url"]);

//keep track of how many posts we've output so we can limit this
$count = 0;

if($rss) {

//get items
$items = $rss->channel->item;

//go through each item and output title and length of time since it was posted
foreach($items as $item) {
if ($count < $size) {
$title = strip_tags($item->title);
$description = strip_tags($item->description);
//$title = str_replace (" ", "%20", $title);
$link = strip_tags($item->link);
$published_on = strip_tags($item->pubDate);
$published_on = date('Y-m-d H:i:s', strtotime($published_on));
//$d = countTime($published_on);
$temparr = array("posttitle" => $title, "postlink" => $link, "postdescription" => $description, "date" => $published_on, "via" => $feed["title"]);
array_push($postarray,$temparr);
$count++;
}
}
}

}
lerkan69 är inte uppkopplad