Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Rss viewing issue

Posted on 2009-07-07
13
Medium Priority
?
336 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?
0
Comment
Question by:middleofnowhere
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 20

Expert Comment

by:Gawai
ID: 24793028
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
 
LVL 20

Expert Comment

by:Gawai
ID: 24793039
0
 

Author Comment

by:middleofnowhere
ID: 24793081
I checked and correct that part. but it's still same.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 20

Expert Comment

by:Gawai
ID: 24794292
post you complete code pls
0
 

Author Comment

by:middleofnowhere
ID: 24794321
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
 

Author Comment

by:middleofnowhere
ID: 24797107
so what do you think?
0
 
LVL 20

Accepted Solution

by:
Gawai earned 2000 total points
ID: 24801076
>><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
 

Author Comment

by:middleofnowhere
ID: 24801665
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
 

Author Comment

by:middleofnowhere
ID: 24801860
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
 
LVL 20

Expert Comment

by:Gawai
ID: 24802222
length is optional, its to mention length of the data
0
 
LVL 20

Expert Comment

by:Gawai
ID: 24802286
just try to replace some of special chars. like < >' " & not all
0
 

Author Comment

by:middleofnowhere
ID: 24802309
another cool info and its done :)

thank you!
0
 
LVL 20

Expert Comment

by:Gawai
ID: 24802450
glad to know it works :D
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question