Solved

Rss viewing issue

Posted on 2009-07-07
13
311 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ajax call to redirect to a different page with data from controller 7 50
Form not operating correctly. 1 23
Form Processing in PHP 11 32
WP_Query multiple custom taxonomies 5 28
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

867 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

19 Experts available now in Live!

Get 1:1 Help Now