Forums

[resolved] CG feed read not working (31 posts)

  1. cowpie
    Member
    Posted 4 years ago #

    Before I explain the technical problems, let me explain what I want to do first. I set up wordpress without problems. I also have a website I am creating. I want to display my wordpress blog entries on the website I created. The only way I can think to do something like this is to read the rss file.

    As a result, I tried using carp and that didn't work. After that I tried CG Feedread and that didn't work either. For each, I could read feed from other rss feeds, but not my own blog. It is getting extremely frustrating. The code I am using for feedread:

    in the head section:
    <?php require('http://[mydomain].com/blog/wp-blog-header.php'); ?>

    where I want the feed to display:
    <?php
    $feedUrl = "http://www.[mydomain].com/blog/wp-rss2.php";
    $feedOut = getSomeFeed($feedUrl, 4, false, "feed-realfeed", '', 36, false);
    if ($feedOut)
    echo $feedOut;
    ?>

    I can access the rss feed when I type it in the browser so I know it is there. Does anyone have a clue ?

  2. Beel
    Member
    Posted 4 years ago #

    Not without a link to your blog, especially since you say other site feeds work just fine.

  3. davidchait
    Member
    Posted 4 years ago #

    As Beel said, not without a link to your feed. Generally, it's a problem with the feed itself -- try using one of the feed validators to look at it. The browsers will display improper feeds in lots of cases... But many of the aggregators and rebloggers will fail as they use more fine-tuned code that assumes the format is correct, rather than assuming the format might be potentially faulty. ;)

    -d

  4. cowpie
    Member
    Posted 4 years ago #

    the url for the feed is: http://www.realivy.com/blog/wp-rss2.php ; for the blog itself realivy.com/blog

  5. Beel
    Member
    Posted 4 years ago #

    I tested that link and it works fine using CG-Feedread
    <?php getSomeFeed('http://www.realivy.com/blog/wp-rss2.php', 4, true, "TEST", '', '', '', false, true, false); ?>

  6. cowpie
    Member
    Posted 4 years ago #

    What should I have in my head section of the page? I think that might be my problem. When I have nothing and when I use the code that Beel just posted, I get this error

    "Fatal error: Call to undefined function: getsomefeed() ..."

  7. Beel
    Member
    Posted 4 years ago #

    I thought you said you had this working for other feeds? You need to have CG-Feedread activated and in the head something like:

    <?php require_once('/path-to/wp-config.php'); ?>

    (or to cg-feedread.php)

    I don't think you can include php using http (someone correct me if I am wrong).

  8. cowpie
    Member
    Posted 4 years ago #

    Beel, I apologize for being such a newbie with all of this. I immagine I am frustrating you with my questions. However, I receive this when Ihave the above command"

    Fatal error: main(): Failed opening required '/blog/wp-content/plugins/cg-plugins/cg-feedread.php' (include_path='.:/usr/local/lib/php') in

    When I try using the whole path like /www/htdocs etc it still doesn't work.

  9. Beel
    Member
    Posted 4 years ago #

    You need to use the full path on your server if you start with a "/" - which might mean "/home/sitename/public_html/..."

    You might be able to use a relative link to the file, depending on where you are calling it from.

  10. Beel
    Member
    Posted 4 years ago #

    I have such a bad memory and switching from one host to another, plus hosting a page off my computer on a Windoze box causes me to forget just what the full path may be so I sometimes throw a <?php echo dirname(__FILE__); ?> in the page I am working on.

  11. cowpie
    Member
    Posted 4 years ago #

    <?php require_once('/www/r/realivycom/htdocs/blog/wp-config.php'); ?>
    <?php require_once('/www/r/realivycom/htdocs/blog/wp-content/plugins/cg-plugins/cg-feedread.php'); ?>

    I put those in my head section and when trying to load the page I get a 500 internal server error. I installed feedread properly. I'm not sure if this matters, but there was a cgfeeds.php file in an extras folder in the unzipped download. I didn't konw where to put it, so I didn't put it anywhere, since I figured it was an extra.

  12. Beel
    Member
    Posted 4 years ago #

    Use just the cg-feedread one and descrobe the error, if any.

  13. cowpie
    Member
    Posted 4 years ago #

    the page just tries to load and load and nothing happens, see for yourself:
    http://www.realivy.com/index2.php

  14. Beel
    Member
    Posted 4 years ago #

    Interesting. Well, since the page is in the root directory, use a relative path to cg-feedread.

    <?php require_once('blog/wp-content/...'); ?>

    if that doesn't work, post your index2 in pastebin.com

  15. cowpie
    Member
    Posted 4 years ago #

  16. Beel
    Member
    Posted 4 years ago #

    http://pastebin.com/396767

    Doh! The function returns the feed so you have to echo it (I was using it in conjunction with CG-QuickPHP in a page which echoes the result). Sorry about that :)

  17. cowpie
    Member
    Posted 4 years ago #

    frustratingly, using the HTML you pasted on pastebin did not work either. I get a 500 internal server error if I wait long enough.

  18. Beel
    Member
    Posted 4 years ago #

    Well it is frustrating and I am stumped. I just copied the source from the link, created a test.php file and ran it just fine on my site (changing "blog" to "wordpress" to match my WP location).

    Maybe David will have an idea when he checks in.

  19. cowpie
    Member
    Posted 4 years ago #

    Ok thanks Beel. I truly appreciate your help.

  20. TechGnome
    Moderator
    Posted 4 years ago #

    Just out of curiosity, is the cg-feedread cache folder writable?

    -tg

  21. cowpie
    Member
    Posted 4 years ago #

    Yes, I had the permissions at 755 and 777, neither worked

  22. davidchait
    Member
    Posted 4 years ago #

    Umm, even if the cache directory isn't writeable, I think feedread should still output properly. If it doesn't, I should fix that (it's supposed to output the error somewhere, AND output the feed).

    I looked at Beel's last pastebin entry, and it looks pretty good to me. If the require() statement is failing, you have to get that path correct -- ANY script you try to use will have that as an issue...

    However, I also just looked at the SOURCE OUTPUT of your index2.php, and if you get halfway down the page it 'restarts' the output (i.e., DOCTYPE, etc., starts all over again). So it is likely that your index2.php has something else wrong with it...

    BTW, if you want this to be on the front page of your blog, obviously the theme system will already have all plugins setup/included by the time it gets to wp-content/themes/yourtheme/index.php, and as long as you've activated the feedread plugin 'stub', you can call getSomeFeed within index or any other wp php file(s). if you want a front page that ISN'T the main index.php of WP, but is a level ABOVE the blog, then you do need to include either wp-config.php or cg-feedread.php to get the ball rolling.

    So, to start with, make sure you are trying to set up the site with WP at the top level (using the standard/included index.php and ONLY modifying the >theme< index.php file), or not at the top level (with a custom top level index.php). Then, take a long hard look through your index2.php code, as you are likely somehow re-including something setup-wise twice, or had a copy-and-paste error.

    -d

  23. cowpie
    Member
    Posted 4 years ago #

    Thanks for the thorough post. However, what I'm afraid of is that I'm too much of a newbie to follow your language.

    How can I look at "source output"?

    Does a level above the blog mean, in the wordpress (in my case "blog") folder where wordpress' components are contained?

    I also tried getting the feed to read in a separate http://www.realivy.com/test.php file and that did not work.

  24. davidchait
    Member
    Posted 4 years ago #

    depending on your browser, View -> Source or View -> Page Source. If you are making custom pages in HTML, you have to know that functionality...

    a level above the blog means IF you have WP installed in {site}/blog/, and not at the root of {site}.

    you'd have to post the code to test.php. without code, we can't tell a thing if the page isn't working. ;)

    -d

  25. cowpie
    Member
    Posted 4 years ago #

    oh you just meant the source, I thought "SOURCE OUTPUT" was something different. In my source, the doctype stuff doesn't happen twice, I'm not sure where you see that it does. I'm making the site in dreamweaver, and it is acting oddly sluggish there.

    http://pastebin.com/397602

    I have WP installed in the /blog folder. I'm trying to implement it in pages in my root folder.

  26. Beel
    Member
    Posted 4 years ago #

    There is a second doc type in the source of index2.php (I just checked).

    Get rid of everything but the head and cg-feedread call. Once working you can add back in the other stuff (sans the second doc type).

  27. cowpie
    Member
    Posted 4 years ago #

    I found out that the second doc type is from when I called in menu.php, I solved that issue, but that still was not the problem. the test.php is barebones and doesn't work.

  28. davidchait
    Member
    Posted 4 years ago #

    The only other thing I can offer is to have you get me ftp access to your account, so I can live upload-and-debug what's occurring.

    Since CG-Feedread uses 'fallback' code to ensure functionality, it should work on most any server installation. However, it is possible that your server has particular quirks in its configuration. Feel free to drop me an email offline at cgcode at chait dot net, and I'll be happy to try and give it a look directly.

    -d

  29. davidchait
    Member
    Posted 4 years ago #

    Okay, so here's the solution (I might post a bigger post so more folks know...).

    cowpie is hosted on PowWeb. PowWeb, in their infinite wisdom, has implemented some kind of load-balancing solution for all websites. This has the side effect of basically locking-up any internal fopen/etc. of a powweb page using 'normal' URL conventions.

    The solution (spent 10 minutes in the powweb forums looking at PHP Q&A) is to rewrite internal requests to use 'localhost'. So:
    http://www.realivy.com/blog/wp-rss2.php
    MUST INSTEAD BE
    http://localhost.realivy.com/blog/wp-rss2.php
    ... when trying to fopen/fsockopen/etc. that web page from within a powweb site. (I'm not sure if it is only the case of a powweb site trying to fopen its OWN http URL, or all powweb URLs... I could see both being potential problems).

    When I replaced www with localhost in the getSomeFeed call, everything IMMEDIATELY works.

    -d

  30. cowpie
    Member
    Posted 4 years ago #

    david, you are the man. I would also like to thank Beel for his efforts. I will not forget the excellent help you guys provided.

    Now this is a minor question that I'm sure I can find somewhere else, when getting hte feed for certain categories, the cmd is just like ...wp-rss2.php?s=2 or something right?

Topic Closed

This topic has been closed to new replies.

About this Topic