Help with php

I really could use some help with writing some php. I am new to php and really need help. I am trying to pull in an xml feed into a wordpress site. I have been able to do that part but I need to only show certain entries and I don’t know how to do that.

Here is the code I have:

<?php $html =""; $url = "http://www.udel.edu/udaily/includes/feed.xml"; $xml = simplexml_load_file($url); for ($i = 0; $i < 10; $i++) { $headline = $xml->story[$i]->headline; $description = $xml->story[$i]->description; $html .= "

$headline

$description

"; } echo $html; ?>

It works great but I only want to show the UD-GRAD entries that are in the “keywords” node. How do I do that. Here is an example of how it is done with javascript: http://www.udel.edu/gradoffice/divi/grad-feed3.html

I know I must be overlooking something. I have tried xpath but I really don’t know what I am doing.

Thanks for any help!

I’m taking a shot in the dark without testing.

[php]<?php
$html ="";
$url = “http://www.udel.edu/udaily/includes/feed.xml”;
$xml = simplexml_load_file($url);
for ($i = 0; $i < 10; $i++) {
$headline = $xml->story[$i]->headline;
$description = $xml->story[$i]->description;
$keywords = $xml->story[$i]->keywords;
if (strpos($keywords,‘UD-GRAD’) !== false) {
$html .= “

$headline

$description

”;
}
}
echo $html;
?>[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service