/    Sign up×
Community /Pin to ProfileBookmark

PHP/XML Printer Friendly

Hello,

I’m parseing XML/RSS onto my page using php. Working fine so far, but i need help with one part.

the link in the RSS to the article is
[url]http://www.medicalnewstoday.com/articles/133241.php[/url]

But what i would like to do is instead of pulling out that link, i would like to pull out the printer friendly link which is contained in the article, so for this page i would like to display

[url]http://www.medicalnewstoday.com/printerfriendlynews.php?newsid=133241[/url]

How would i go about modifying my code for this ?

[code=php]
$rss_document = simpleXML_load_file(‘http://www.medicalnewstoday.com/rss/allergy.xml’);

/Loop through each item in document
foreach($RSS_doc->channel->item as $RSS_item) {
//The variable $RSS_item will hold a different item for each loop
//Write the current item’s title to the screen in HTML tags
echo “<h3>$RSS_item->title</h3>”;
echo “<a href='”.$RSS_item->link.”‘>{$RSS_item->link}</a><br />”;
echo “<b>$RSS_item->pubDate</b><br />”;
echo “$RSS_item->description<br /><br />”;

[/code]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@HappyFace19authorDec 19.2008 — should this be posted in the XML forum ?
×

Success!

Help @HappyFace19 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.10,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...