Marook-Online
* 06.Feb.2012, 14:54 UTC+1
Welcome, Guest. Please login or register.
Username:
Password:

News: Back again Wink
Main Menu
  Navigation
   Downloads
     Tools
     Music Discs
     SMF Mods
     Trainer & Patches
     EgoShare Uploader
   Guestbook
   NoPaste
   User Map
   Gallery
  
   Malware Scan
   Hacker Blacklist
   Find Abusemail
Top Downloads
Support Me !
Help me by donating a small amount!



Advanced search

Google


Pages: [1]   Go Down
0 Members and 1 Guest are viewing this topic. Topic Tools  
Read
07-Nov-2007 06:44
Marook
Administrator
*****
Offline Offline

Joined: 01-Jan-2005
Posts: 224


Its very easy to get information from a rss-feed with PHP, look at this code.

Code
GeSHi (php-brief):
  1. <?php
  2. // URL of the feed
  3. $url = 'http://marook-online.de/smf/index.php?action=.xml&limit=10&type=rss2';
  4. // Max length of link <a href=www.google.com>i_mean_this_here</a>
  5. $maxl = 20;
  6.  
  7. // Create the xml parser
  8.  $p = xml_parser_create();
  9. // Get content from feed and store it into variable
  10.  xml_parse_into_struct($p,file_get_contents($url),$results,$index);
  11. // Free resources
  12.   xml_parser_free($p);
  13.  
  14. // Do a For-Loop 10 times to get the 10 recent posts  
  15.    for ($i = 1; $i <= 10; $i++) {
  16.    // Store the title
  17.   $title = $results[$index[TITLE][$i]][value];
  18.   // Store the link
  19.     $link = $results[$index[LINK][$i]][value];
  20.    // Display the link, the tooltip is showing the whole title
  21.    // where the link name is shortend to the max-length plus "..." to
  22.    // indicate, that the link is shortened.
  23.     echo '<li><a title="' . $title . '" target=_blank href=' . $link . '>' . substr($title,0,$maxl) . ' ...</a></li>' . "\n";
  24.    }
  25. ?>
Created by GeSHI 1.0.7.20
Logged
 

Pages: [1]   Go Up
Jump to:  

Theme by webtechnica.net

MHD v2.1 © 2oo8 by Marook
32116 hacking attempts defended!