We help IT Professionals succeed at work.

Rss viewing issue

452 Views
Last Modified: 2013-12-13
Hello,

I'm having some obstacles on viewing rss feeds on firefox (at least I just tried on firefox). So I'm trying to made my rss file dynamically via php.

link : http://www.orgalink.net/rss/

First of all its working on my local php mysql server. I can get all feeds clearly. But when I try to get them via link above, it doesnt show anything on page. but source code seems fine.

by the way I'd like to show images of feeds. I've checked of apple.com's rss feeds in order to make proper rss source code. but I couldnt make it. there is a tag like <content:encoded> in their feeds. example code :

<item>
<title>Fifty Dead Men Walking</title>
<link>http://www.orgalink.net/orgalink/292</link>
<description>Martin 0ngiliz Polisi taraf1ndan IRA'ya s1zmak ve 0ngiltere için istihbarat toplamakla görevlendirilir, birkaç sene bilgi s1zd1rsa da aç1a ç1kt1 gün, örgütün i_kencelerine maruz kalmaktan kaçamaz.

Film, Martin McGartland'1n otobiyografik roman1ndan uyarlananm1_ ve gerçek hayatta da Martin halen saklanmaya devam etmektedir.</description>
<content:encoded><table border="0" width="100%" cellspacing="5" cellpadding="0" style="font-size: 12px; color: #333;"><tr valign="top" align="left"><td align="center" width="56" valign="top"><a href="http://www.orgalink.net/orgalink/292"><img border="0" src="http://www.orgalink.nethttp://www.orgalink.nethttp://www.orgalink.nethttp://www.orgalink.nethttp://www.orgalink.net/_section_images/thumb50-3411246847909.jpg3401246845710.jpg3381246368632.jpg3371246367510.jpg3361246366745.jpg" width="56" height="56"></a></td><td><b>Fifty Dead Men Walking</b><br />
Martin 0ngiliz Polisi taraf1ndan IRA'ya s1zmak ve 0ngiltere için istihbarat toplamakla görevlendirilir, birkaç sene bilgi s1zd1rsa da aç1a ç1kt1 gün, örgütün i_kencelerine maruz kalmaktan kaçamaz.

Film, Martin McGartland'1n otobiyografik roman1ndan uyarlananm1_ ve gerçek hayatta da Martin halen saklanmaya devam etmektedir.</td></tr></table></content:encoded>

<pubDate>Thu, 01 Jan 1970 01:33:29 GMT</pubDate>

</item>


it seems like special screening for some of devices (maybe phones). I dont have so much information about rss feeds but I need to create for site users.

so how can I make it in a proper way?
Comment
Watch Question

Commented:
End tag 'a' does not match the start tag 'img'.
 Line: 24 Character: 352

<content:encoded><table border="0" width="100%" cellspacing="5" cellpadding="0" style="font-size: 12px; color: #333;"><tr valign="top" align="left"><td align="center" width="56" valign="top"><a href="http://www.orgalink.net/orgalink/297"><img border="0" src="http://www.orgalink.net/_section_images/thumb50-3421246967143.jpg" width="56" height="56"></a></td><td><b>Orbital</b><br />

Author

Commented:
I checked and correct that part. but it's still same.

Commented:
post you complete code pls

Author

Commented:
by the way I'm having issues about utf-8 chars.
<?
header('Content-Type: text/xml; charset=windows-1254');
require_once($_SERVER['DOCUMENT_ROOT']."/getdb/db.php");
 
 
$getnews = mysql_query("SELECT * FROM content LIMIT 40");
 
$maintitle = "Son girilen içerikler";
$maindesc = "Orgalink.net Yeni erikler Sayfas";
$sitelink = "orgalink.net";
$mainlink = "http://www.orgalink.net";
$sectionlink = "/orgalink/";
 
$imglink = "/_section_images/thumb50-";
 
 
echo '<?xml version="1.0" encoding="ISO-8859-1"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">';
?>
<channel>
<title><?=$maintitle?> - <?=$sitelink?></title>
<link><?=$mainlink?></link>
<description><?=$maindesc?></description>
<copyright>Copyright 2009, Orgalink.net</copyright>
<image>
<title>Orgalink</title>
<width>150</width>
<height>50</height>
<link>http://www.orgalink.net</link>
<url>http://www.orgalink.net/_images/logo_bottom.png</url>
</image>
 
 
<?
 
while($data = mysql_fetch_object($getnews)) {
 
$imglinks = $mainlink.$imglink.$data->img.$getimg.".jpg";
 
$eventlink = $data->contentid;
$golink = $mainlink.$sectionlink.$eventlink;
 
$title = $data->title;
 
 
$tm=$data->date;
$tm=date("D, d M Y H:i:s",$tm);
$date=$tm. " GMT";
 
?>
 
<item>
<title><?=$title?></title>
<link><?=$golink?></link>
<description><?=substr($data->content,0,200)?>...</description>
<content:encoded><table border="0" width="100%" cellspacing="5" cellpadding="0" style="font-size: 12px; color: #333;"><tr valign="top" align="left"><td align="center" width="56" valign="top"><a href="<?=$golink?>"><img border="0" src="<?=$imglinks?>" width="56" height="56"></a></td><td><b><?=$title?></b><br />
<?=substr($data->content,0,200)?>...
</td></tr></table></content:encoded>
 
<pubDate><?=$date?></pubDate>
 
</item>
<? 
 
$imglinks = "";
} ?>
 
 
 
 
</channel>
</rss>

Open in new window

Author

Commented:
so what do you think?
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
that's great! all the problem is about some of special chars like < >" & etc.
Its working fine after your method. I'm having just utf-8 chars but I will find a php function to replace chars.

and I'd like ask for what is the purpose of this line :
<enclosure type="image/jpeg" length="56200" url="http://www.sahilnews.org/gallery2008/images/20081006064037_sth72378_jpg_595.jpg" />

and what for the "length" value in it?

anyway thank you for great help!

Author

Commented:
allright I give up!
I tried many different replace function in order to achieve UTF-8 chars but I couldnt make it.

function xml_character_encode($string, $trans='') {
  $trans = (is_array($trans)) ? $trans : get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
  foreach ($trans as $k=>$v)
    $trans[$k]= "&#".ord($k).";";

  return strtr($string, $trans);
}


this is what I'm using for it. but if you can check is you'll see that issue.
http://www.orgalink.net/rss/


do you have any idea for correction of utf-8 chars?

Commented:
length is optional, its to mention length of the data

Commented:
just try to replace some of special chars. like < >' " & not all

Author

Commented:
another cool info and its done :)

thank you!

Commented:
glad to know it works :D
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.