Witam...
Mam problem z skryptem rss get.. ³adnie wy¶wietla wiadomo¶ci ale linki ¼le wy¶wietla bo wy¶wietla:
http://wiadomosci.onet.pl/17839451111item.html
zamiast
http://wiadomosci.onet.pl/1783945,11,1,1,item.html

Przecinki gubi
zobaczcie tak wy¶wietla: Czytnik

Skrypt:
index.php
  1. <?
  2. $url = "http://wiadomosci.onet.pl/2,kategoria.rss";
  3. $displayname = "Slashdot /.";
  4. include "rss_get.php";
  5. ?>


rss_get.php
  1. <?php
  2.  
  3. #==========================
  4. # The following line declares how long to wait before reloading the RSS feed. 
  5. # Keep in mind, many sites discourage people from pulling its feed more often th
    an 30 minutes.
  6. # For example, Slashdot.org may ban your server if it tries to load the rss feed
     too often.
  7.  
  8. # You may change the below line.
  9. #==========================
  10.  
  11. $minutes = 30; //How often to update the image. 0 indicates that image updates every time it is c
    alled (heavy strain on bandwidth & server)
  12.  
  13. #==========================
  14. # The next line is what directory to dump the htm files generated by this script
    .
  15. # It should be relative to the location of this script, and it *MUST* have a tra
    iling slash if it's a seperate dir.
  16. # If you want the files to be dumped in the same dir as this script, set it to ""
  17.  
  18. # You may change the next line
  19. #==========================
  20.  
  21. $filename = "rss/";
  22.  
  23. #==========================
  24. # The next 4 lines are default settings for the script to use, if they are not s
    et prior to including this script
  25. # You may change the next 4 lines.
  26. #==========================
  27.  
  28. $default_url = "http://www.aarondunlap.com/rss.php?mode=hl"; //URL for the RSS/XML feed you're subscribing to.
  29. $default_displayname = "|| aarondunlap.com ||"; //Title to appear before headlines. Should be feed-specific
  30. $default_number = 5; //How many headlines to display. If you set it higher than the ammount of headline
    s, it will stop there
  31. $default_target = "_self"; //Target for headline links. Options: "_self" and "_blank"
  32.  
  33.  
  34. #==========================
  35. # The settings below are for advanced headline truncation.
  36.  
  37. # $default_trunc is how many characters to cut off at, 
  38. # the default is FALSE, which wont truncate
  39. # at all. 
  40.  
  41. # You may use $trunc when calling this script
  42. # to define the truncation for specific feeds
  43.  
  44. # $default_delim is what character to cut off the headline at
  45. # for example, if your headlines contain useless
  46. # data at the end, like "(via Reuters)", setting
  47. # the delimiter to "(" will stop that from showing.
  48.  
  49. # You may use $delim when calling this script
  50. # to define the truncation for specific feeds
  51.  
  52. #===========================
  53.  
  54. $default_trunc = FALSE;
  55. $default_delim = FALSE;
  56.  
  57. #XXXXXXXXXXXXXXXXXXXXXXXXXX
  58. # Everything below is functional code.
  59.  
  60. # You should not change it unless you know what you're doing,
  61. # and even if you do know what you're doing, are you sure you're
  62. # awake enough to do it? Maybe take a nap, rethink things, try again.
  63. #XXXXXXXXXXXXXXXXXXXXXXXXXX
  64.  
  65. $version = 1.5;
  66.  
  67. //If these variables aren't declared already, use defaults.
  68. if (!isset($url)) { $url = $default_url; }
  69. if (!isset($displayname)) { $displayname = $default_displayname; }
  70. if (!isset($number)) { $number = $default_number; }
  71. if (!isset($target)) { $target = $default_target; }
  72. if (!isset($trunc)) { $trunc = $default_trunc; }
  73. if (!isset($delim)) { $delim = $default_delim; }
  74.  
  75.  
  76. //In-URL definitions. Cannot be used for including, but it works great for testing.
  77. if (isset($_GET['url'])) { $url = $_GET['url'];}
  78. if (isset($_GET['number'])) { $number = $_GET['number'];}
  79. if (isset($_GET['displayname'])) { $displayname = $_GET['displayname'];}
  80. if (isset($_GET['rssHeadline'])) { $rssHeadline = $_GET['rssHeadline'];}
  81. $basefile = $filename; 
  82. $versionfile = $filename."updatelog.htm"; //File for update attempt log
  83. $filename .= md5($url).".htm"; //Prepare filename for htm output
  84.  
  85.  
  86. #==========================
  87. # Check the modify time of the htm file for this feed, and see if it's too new to reload the feed.
  88. # If the file is too new, it loads the htm file. This stops the script from cons
    tantly pulling the feed.
  89. #==========================
  90.  
  91. if (($minutes > 0) && (is_file($filename)) && (((time()-filemtime($filename)) < ($minutes * 60)))) { 
  92. include $filename;
  93. $time = floor((time()-filemtime($filename)) / 60); //See how many "minutes ago" the file was made.
  94. echo "<br><i><span class=\"updated\">Updated $time minutes ago.</span></i>"; //Include "minutes ago" after output.
  95.  
  96. } elseif (@fopen($url,"r")) { //Makes sure the file can actually be accessed.
  97.  
  98. #==========================
  99. # If we're down here, it means that the feed needs to be reloaded.
  100. #==========================
  101.  
  102. $rssHandle = fopen($url,"r") ; // Open the rss file for reading 
  103.  
  104. while (!feof($rssHandle)) {
  105. $rssData .= fgets($rssHandle);
  106. }
  107.  
  108. #==========================
  109. # Feed parsing
  110. #==========================
  111. $tag = "item ";
  112. $rssData = preg_replace("/<" . $tag . "(.|s)*?>/","<item>",$rssData);
  113. $rssData = chop($rssData); // Strip any whitespace from the end of the string
  114. $rssData = ereg_replace("[r,\n]", "", $rssData); //Clear line breaks
  115. $rssData = strstr($rssData,"<item>"); //Remove everything before <item>.
  116.  
  117. #==========================
  118. # Strip specific tags and their content from the feed, to lighten the strain on 
    the processor.
  119.  
  120. # Currently, only the <description></description> tags are stripped, we don't need them and sometimes
  121. # they are REALLY long, getting rid of them now makes it easier to parse later.
  122. #==========================
  123. $tags_and_content_to_strip = Array("description");
  124.  
  125. foreach ($tags_and_content_to_strip as $tag) {
  126.  $rssData = preg_replace("/<" . $tag . ">(.|s)*?</" . $tag . ">/","",$rssData);
  127. }
  128.  
  129. $rssData = str_replace("<item>","", $rssData); //Remove <item> itself
  130. $rssData = urldecode($rssData); //Replace any silly %20-type characters with their readable replacement.
  131. $rssData = str_replace(strstr("</channel>",$rssData),"",$rssData);
  132. $rssArray = explode("</item>",$rssData); //Creates an Array from all the headlines
  133.  
  134. $title = array();
  135. $link = array();
  136.  
  137. #==========================
  138. # This loop creates an array for links and another for titles.
  139. #==========================
  140. $x = 0;
  141. while($x < $number) {
  142. $link[$x] = strstr($rssArray[$x],"<link>"); //Remove everything before <link>
  143. $link[$x] = ereg_replace("<link>","",$link[$x]); 
  144.  
  145.  $link[$x] = str_replace(strstr($link[$x],"</link>"),"",$link[$x]);
  146.  $link[$x] = trim($link[$x]);
  147.  
  148. $title[$x] = strstr($rssArray[$x],"<title>");
  149. $title[$x] = ereg_replace("<title>","",$title[$x]); // Remove the leading <title> tags from the selected headline
  150. $title[$x] = str_replace(strstr($title[$x],"</title>"),"",$title[$x]); // Remove </title> and anything after it
  151. $title[$x] = trim($title[$x]);
  152.  
  153. if ($trunc != FALSE) { $title[$x] = str_replace(substr($title[$x],$trunc),"",$title[$x]); }
  154. if ($delim != FALSE) { $title[$x] = str_replace(strstr($title[$x],$delim),"",$title[$x]); }
  155.  
  156. if ($title[$x] == "") { $number = $x; break; } //If there are no more headlines, reset $number to the max.
  157. $x++;
  158. }
  159.  
  160. #==========================
  161. # Writing the file
  162. #==========================
  163. $fp = fopen($filename, "w+"); 
  164. $x=0;
  165. fwrite($fp,"<b><span class=\"displayname\">$displayname</span></b> \n"); //Write the displayname to the file
  166.  
  167. while ($x < $number) { //This loop writes each line individualy.
  168. fwrite($fp,"<br>\n-<a class=\"headlinellink\" target=\"$target\" href=\"$link[$x]\">$title[$x]</a>");
  169. $x++;
  170. }
  171.  fclose($fp);
  172.  include $filename;
  173.  echo "<br><i><span class=\"updated\">Live.</span></i>";
  174.  
  175.  } else { 
  176. #==========================
  177. # Error handling:
  178. # (rss url given is unreadable)
  179. #==========================
  180. echo "<b>Could not connect to $url. </b>"; 
  181.  
  182. }
  183.  
  184. ?>


Proszê o pomoc