Solved

Rss viewing issue

Posted on 2009-07-07
13
310 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
  • 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
 
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 20

Accepted Solution

by:
Gawai earned 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now