Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

Rss viewing issue

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?
0
middleofnowhere
Asked:
middleofnowhere
  • 7
  • 6
1 Solution
 
GawaiCommented:
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 />
0
 
middleofnowhereAuthor Commented:
I checked and correct that part. but it's still same.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
GawaiCommented:
post you complete code pls
0
 
middleofnowhereAuthor 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

0
 
middleofnowhereAuthor Commented:
so what do you think?
0
 
GawaiCommented:
>><content:encoded><table border="0" width="100%" .....
you u need table there ? jus remove that and see the result. also

& - replace all instances of '&' with the following: &amp;
> - change every 'greater than' character to >
< - change every 'less than' character tag to <
 
sample attached
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0">
<channel>
<title>SahilOnline Photo Gallery</title>
<link>http://www.sahilnews.org/gallery2008/</link>
<description>SahilOnline Photo Gallery Dubai Eid Milan 2008</description>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<copyright>Copyright 2008 http://www.sahilnews.org, All Rights Reserved.</copyright>
 
<item>	
<title>bmj dubai eid milan 2008 photo 9</title>
<link>http://www.sahilnews.org/gallery2008/index.php?showimage=11</link>
<description>	&lt;img src=&quot;http://www.sahilnews.org/gallery2008/thumbnails/thumb_20081006064037_sth72378_jpg_595.jpg&quot;&gt;&lt;br/&gt;
		bmj dubai eid milan 2008 photo 9
	
</description>	
<enclosure type="image/jpeg" length="56200" url="http://www.sahilnews.org/gallery2008/images/20081006064037_sth72378_jpg_595.jpg" />	
<pubDate>Mon, 06 Oct 2008 06:40 +0000</pubDate>
<guid isPermaLink='true'>http://www.sahilnews.org/gallery2008/index.php?showimage=11</guid>	
</item>	
 
</channel>
</rss>

Open in new window

0
 
middleofnowhereAuthor 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!
0
 
middleofnowhereAuthor 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?
0
 
GawaiCommented:
length is optional, its to mention length of the data
0
 
GawaiCommented:
just try to replace some of special chars. like < >' " & not all
0
 
middleofnowhereAuthor Commented:
another cool info and its done :)

thank you!
0
 
GawaiCommented:
glad to know it works :D
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now