Go Back   SitePoint Forums > Forum Index > Program Your Site > PHP
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Jul 2, 2004, 07:06   #1
ArticleBot
SitePoint Articles
 
ArticleBot's Avatar
 
Join Date: Apr 2001
Posts: 0
Article Discussion

This is an article discussion thread for discussing the SitePoint article, "PHP and XML: Parsing RSS 1.0"
ArticleBot is offline   Reply With Quote
Old Feb 28, 2005, 10:19   #2
podger
SitePoint Member
 
Join Date: Feb 2005
Location: london
Posts: 1
A great article - exactly what I needed. In addition, could anyone tell me how to limit the number of items that are displayed. For example, if I wanted to list just the latest three items from a feed that has 25 items listed, how would I tell the parser to stop at 3?

Thanks

Gareth
podger is offline   Reply With Quote
Old May 29, 2005, 11:05   #3
trhynard
SitePoint Addict
 
Join Date: Apr 2001
Location: Michigan
Posts: 382
Great Article! One of the best on this subject.
trhynard is offline   Reply With Quote
Old Jul 12, 2005, 05:55   #4
tobyhede
SitePoint Zealot
 
Join Date: Mar 2005
Posts: 118
Very timely! I have been looking for a replacement for the excellent MagpieRSS, and the only real option at this stage seems to be writing our own RSS reader.
tobyhede is offline   Reply With Quote
Old Aug 25, 2005, 04:17   #5
operator
SitePoint Evangelist
 
operator's Avatar
 
Join Date: Aug 2004
Location: Bangkok
Posts: 529
This article worked perfectly for me with fopen enabled. But my webhost has fopen disabled. I had to plug in the following code to get it to work without using fopen:

PHP Code:

 $ch = curl_init();
  
curl_setopt( $ch, CURLOPT_URL, "http://www.example.com/headlines.jsp" );
  
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  
$data = curl_exec( $ch );
  if( empty(
$data )) die("Error reading RSS data.");
  
  
xml_parse($xml_parser, $data ) or
      die(
sprintf("XML error: %s at line %d",
          
xml_error_string(xml_get_error_code($xml_parser)),
          
xml_get_current_line_number($xml_parser)));
  
  
curl_close($ch);
operator is offline   Reply With Quote
Old Sep 5, 2005, 17:02   #6
SmoothDime
SitePoint Enthusiast
 
Join Date: Jan 2005
Location: California
Posts: 28
Quote:
Originally Posted by operator
This article worked perfectly for me with fopen enabled. But my webhost has fopen disabled. I had to plug in the following code to get it to work without using fopen:

PHP Code:

 $ch = curl_init();

  
curl_setopt( $ch, CURLOPT_URL, "http://www.example.com/headlines.jsp" );
  
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  
$data = curl_exec( $ch );
  if( empty(
$data )) die("Error reading RSS data.");
  
  
xml_parse($xml_parser, $data ) or
      die(
sprintf("XML error: %s at line %d",
          
xml_error_string(xml_get_error_code($xml_parser)),
          
xml_get_current_line_number($xml_parser)));
  
  
curl_close($ch);
can you assign a timeout using the curl() method?

thanks
SmoothDime is offline   Reply With Quote
Old Oct 4, 2005, 11:21   #7
8900200
SitePoint Member
 
Join Date: Aug 2005
Posts: 6
Never mind. I had the rdf extention marked wrong. Works like a charm.
8900200 is offline   Reply With Quote
Old Jul 21, 2009, 21:35   #8
bfarris
SitePoint Member
 
Join Date: Jul 2009
Posts: 6
if the file is remote, you can grab the xml content with cURL or fsocketopen
bfarris is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 01:36.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved