Results 1 to 6 of 6

Thread: Can some one explain why this does not work?

  1. #1
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    612
    Thanks
    46
    Thanked 32 Times in 32 Posts

    Default Can some one explain why this does not work?

    Code:
    <?php
        require_once('simplepie.inc');
    
        $feed = new SimplePie();
    
    
        $feed = new SimplePie();
        $feed->set_feed_url(array(
    	'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml',
    	'http://rss.news.yahoo.com/rss/topstories',
    	'http://news.google.com/?output=atom',
    	'http://rss.slashdot.org/Slashdot/slashdot',
    	'http://rss.cnn.com/rss/cnn_topstories.rss',
    	'http://www.newsvine.com/_feeds/rss2/index'
    ));
    $feed->init();
    $feed->handle_content_type();
    echo $feed->get_title();
    
    
    
    ?>
    I get this error:
    Fatal error: Call to undefined method SimplePie::set_feed_url() in /home/bud/public_html/rss/simplepie/testpage3.php on line 8

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    What is in simplepie.inc?
    To choose the lesser of two evils is still to choose evil. My personal site

  3. #3
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    The script is calling a function called set_feed_url() in the SimplePie class. It's as simple as that.
    - Josh

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by JShor View Post
    The script is calling a function called set_feed_url() in the SimplePie class. It's as simple as that.
    and, apparently, that method does not exist. We can tell the class exists, since the error wasn't thrown on the line above. (Incidentally, why are you constructing the class twice?)

    Are you sure you're calling the right method? typo/misspelled?

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Just some more information on simplepie:

    There have been many versions of simplepie.inc. The names of the functions and how to use them have at times changed.

    Generally I would say make sure you're using the latest version and the correct syntax for that version. A bit tedious I know. But the code and documentation for it are on the simplepie site:

    http://simplepie.org/

    I've worked with it a little, it's very good for feeds.

    But one could use whatever version one has and look through it to see what's in there. That can be even more tedious.

    I've done it both ways, though neither for some time.

    If you know which version you have, the documentation for it may still be available on the simplepie site or elsewhere around the web. It may be easier to work with. But the latest version has all the best features and security.

    For an example of what an older version of simplepie can be made to do, see:

    http://www.dynamicdrive.com/dynamici...ybox/index.htm
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    612
    Thanks
    46
    Thanked 32 Times in 32 Posts

    Default

    Thanks for taking time to look at the post.

    I have found two sources of a simple php code set to use simplepie that do not work.

    One is a script done twice on the simplepie website .One is barebones no styling and the second has styling.

    The other script I found when surfing looking for an example that will work so that I have a basic script other the the display box script so I have more to look at and try tinkering with.

    This has been a disappointing thing because I will learn more faster seeing something that works and looking at the coding used.

    There has to be something siple that is out there but I have yet to find it but I will.

    Bud

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •