We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,267 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

PHP Automatically replace "&" with "&"

I have a RSS reader on a web-page and the RSS it receives have links that contain "&" sign in them. For the page to be valid it needs to be changed to "&". I know this sounds stupid and unnecessary but I want to fix them.

Attached to this post is the PHP I use to get the RSS feed. Can someone help me modify it so i can have it change the "&" to "&"?

Attachments rss_no_bullet.php (2.97KB)
4
Contributors
4
Replies
4 Hours
Discussion Span
3 Years Ago
Last Updated
5
Views
jonow
Junior Poster
104 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Will Gresham
Master Poster
772 posts since May 2008
Reputation Points: 95
Solved Threads: 129
Skill Endorsements: 1

I barely know PHP and I don't know how to implement it.

jonow
Junior Poster
104 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

You can use PHP's str_replace.

$filtered_link=str_replace('&','&',$link_string);
SoftwareDev
Newbie Poster
3 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

urlencode();

the edited line is 108

$page .= "<div class='rss-title'><a target='_blank' href=\"$link\">$title</a></div>";
$page .= "<div class='rss-title'><a target='_blank' href=\"".urlencode($link)."\">$title</a></div>";
Attachments rss_no_bullet_mod.php (2.99KB)
almostbob
Nearly a Senior Poster
3,280 posts since Jan 2009
Reputation Points: 585
Solved Threads: 399
Skill Endorsements: 7

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0725 seconds using 2.72MB