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
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...() ???

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 ???

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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>";
}
?>

Link to comment
Share on other sites

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???

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.