d239113g Posted December 21, 2008 Share Posted December 21, 2008 I've having a little trouble with parse XML onto my page. Most is working, but i just cannot get the $RSS_link to work. The link in the RSS to the article is http://www.medicalnewstoday.com/articles/133241.php but what i want to show is http://www.medicalnewstoday.com/printerfriendlynews.php?newsid=133241 which is the printer friendly version of the article. At the moment with my script, it is displaying http://www.medicalnewstoday.com/printerfriendlynews.php?newsid= but not the article id $rss_document = simpleXML_load_file('http://www.medicalnewstoday.com/rss/allergy.xml'); $url = "http://www.medicalnewstoday.com/printerfriendlynews.php?newsid=" . substr("$RSS_item->link", 41, -4); 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='$url'>$url</a><br />"; echo "<b>$RSS_item->pubDate</b><br />"; echo "$RSS_item->description<br /><br />"; } Link to comment https://forums.phpfreaks.com/topic/137902-printer-freindly-php/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.