Jump to content

[SOLVED] RSS &' character problems ?


plodos

Recommended Posts

.sql

<?php `name` text NOT NULL, ?>

input is "aaaa & aaaa's & aaaaaaaaaa"

 

input.php

<?php 
if(isset($_POST['Submit']))
{
           $name = trim($_REQUEST['name']); 
        }
//insert into XXX set name='aaaa & aaaa's & aaaaaaaaaa'
?>

 

rss.php

<?php 
echo "
<item>
<title>".$opstr['name']."</title>
</item>";
}
?>

 

if name has & or ' characters, rss does not show anything?

 

how will I solve this problem?

Link to comment
https://forums.phpfreaks.com/topic/145287-solved-rss-character-problems/
Share on other sites

<?php 
if(isset($_POST['Submit']))
   {
           $name = trim(htmlspecialchars($_REQUEST['name'])); 
        }
?>

 

I used htmlspecialchars() function...RSS is working now with these & " ' ..

 

htmlspecialchars() is same with CDATA and mysql_real_escape...() ???

I can only say what I've tested and found to be working well.

When I insert data onto database, I pass it through mysql_real_escape_string (no htmlspecialchars)

When I create RSS feed, I use CDATA, where special characters might appear.

you know what are you doing!

 

i change it like that

 

<?php $name = trim(mysql_real_escape_string($_REQUEST['name'])); 

<title> <![CDATA[ ".$opstr['name']." ]]> </title>
?> 

 

but if input is like that => & asda & asd " ' & ' "

RSS is showing like that=> & asda & asd \" \' & \' \"

 

how will I remove the \\\\\\\\\\\\\\\\\\ slashes ???

hımmm I put the stripslashes()...thank you one more time.

 

rss validator is giving me this error:

line 14, column 0: item should contain a guid element (5 occurrences)

line 39, column 0: Missing atom:link with rel="self"

 

rss.php

<?php
$date = date("r", strtotime($opstr["rdate"]));

echo "
<item>
<title>".$opstr['sname']." ".$opstr['year']." - <![CDATA[ ".stripslashes($opstr['name'])." ]]> </title>
<description>".$opstr['city'].", ".$opstr['country']." - ".$opstr['cdate']."</description>
<link>".$opstr['link']."</link>
<pubDate>".$date."</pubDate>
</item>";
} 
?>

 

What are the solutions of the these errors?

I coundt solve it.....what is wrong in <guid> section ?

 

<?php
echo "
<item>
<title><![CDATA[ ".stripslashes($opstr['name'])." ]]> </title>
<description>".$opstr['city']."</description>

<guid><http://www.w3.org/2005/Atom> Atom"     rel=\"self\"     href= ".$opstr['link']."      type=\"application/rss+xml\" /> </guid>
    
<pubDate>".$date."</pubDate>
</item>";
}
?>

I coundt solve it.....what is wrong in <guid> section ?

 

<?php
echo "
<item>
<title><![CDATA[ ".stripslashes($opstr['name'])." ]]> </title>
<description>".$opstr['city']."</description>

<guid><http://www.w3.org/2005/Atom> Atom"     rel=\"self\"     href= ".$opstr['link']."      type=\"application/rss+xml\" /> </guid>
    
<pubDate>".$date."</pubDate>
</item>";
}
?>

error: missing atom:link with rel="self" is not erally an error, but recommendation.

 

My problem is that I have NO IDEA of how to "edit" my RSS feed with <guid>. Can anyone tell me how I locate my RSS feed and what I can use to edit the feed???

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.