SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Addict MikesBarto2002's Avatar
    Join Date
    May 2006
    Location
    New York City
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Magpie rss_fetch() error

    This feed used to work on my old server, and now that I have moved it over to a new server, I get the following error message:

    Fatal error: Call to undefined function: fetch_rss() in /homepages/38/d134451434/htdocs/wsc134451438/includes/footer.php on line 47

    I made sure to move over all of the Magpie files, and it still isn't working. Here is the page below:

    PHP Code:
    <div id="footer">
        <div id="footercontentleft">
            <div id="newsletter">
                <h2 id="h2_newsletter">Newsletter</h2>
                <?php
                    
    if (isset($_POST['newslettersubmit'])) {
                        
    // Initialize error array
                        
    $errors = array();
                        
    // Gather variables
                        
    if (!empty($_POST['newsletteremail'])) {
                            
    $newsletteremail stripslashes($_POST['newsletteremail']);
                        } else {
                            
    $errors[] = "You must enter an EMAIL ADDRESS.";
                            
    $newsletteremail NULL;
                        }
                        if (empty(
    $errors)) {
                            
    // Send confirmation email
                            
    $body "A request has been sent to add the following email address to your email newsletter list:\n\n";
                            
    $body .= "$newsletteremail";
                            
    mail ("info@jameswebdevelopment.com","Alchemy Theatre - Email Newsletter Request",$body,"From: $newsletteremail");
                            echo 
    "Thanks for signing up!";
                        } else {
                            echo 
    '<h3>Error!</h3>';
                            foreach (
    $errors as $msg) {
                                echo 
    "<p>$msg</p>";
                            }
                        }
                    }
                
    ?>
                <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                    <div><label for="newsletteremail">Email</label><input type="text" name="newsletteremail" /></div>
                    <div><input type="submit" name="newslettersubmit" src="http://www.alchemytheatre.org/pics/buttons/newslettersignup.png" /></div>
                </form>
            </div>
            <div id="sponsors">
                <h2 id="h2_sponsors">Sponsors</h2>
                <p>The Alchemy Theatre Company of Manhattan is a resident theatre company at&hellip;</p>
                <p><a href="http://www.theatrerow.org"><img src="http://www.alchemytheatre.org/pics/theatrerow.png" alt="Theatre Row on 42nd Street" /></a></p>
            </div>
        </div>
        <div id="footercontentright">
            <div id="latestblogpost">
                <h2 id="h2_latestblogpost">Latest Blog Post</h2>
                <?php 
                    
    include ('http://www.alchemytheatre.org/magpie/rss_fetch.inc');
                    
    error_reporting(E_ERROR);
                    
    $rss fetch_rss("http://www.alchemytheatre.org/blog/?feed=rss2");
                    if (
    $rss) {
                        echo 
    '<h3><a href="' $rss->items[0]['link'] . '">' $rss->items[0]['title'] . '</a></h3>' "\n";
                        echo 
    '<p>' $rss->items[0]['description'] . '</p>' "\n";
                        echo 
    '<p>Published ' $rss->items[0]['pubdate'] . '.</p>' "\n";
                    } else {
                        echo 
    '<h3>Error:</h3><p>'.magpie_error().'</p>';
                    }
                    @
    ini_restore('error_reporting');
                
    ?>
            </div>
            <div id="navbarbottom">
                <p>Alchemy Theatre | c/o Theatre Row | 410 W. 42nd Street, Office 4E3 | New York, NY 10036<br />T: (212) 967-0901 | F: (646) 304-5657 | E-mail: <a href="mailto:info@alchemytheatre.org">info@alchemytheatre.org</a></p>
                <p class="nomargin">Copyright &copy; 2009, Alchemy Theatre Company of Manhattan.  All rights reserved.</p>  
                <p class="nomargin"><a href="http://www.alchemytheatre.org/buytickets/">Buy Tickets</a>&nbsp;|&nbsp;<a href="http://www.alchemytheatre.org/ourseason/">Our Season</a>&nbsp;|&nbsp;<a href="http://www.alchemytheatre.org/aboutus/">About Us</a>&nbsp;|&nbsp;<a href="http://www.alchemytheatre.org/support/">Support</a>&nbsp;|&nbsp;<a href="http://www.alchemytheatre.org/ourcommunity/">Linking to our Community</a>&nbsp;|&nbsp;<a href="http://www.alchemytheatre.org/press/">Press</a><br /><a href="http://www.alchemytheatre.org/contactus/">Contact Us</a>&nbsp;|&nbsp;<a href="http://www.alchemytheatre.org/blog/">Blog</a>&nbsp;|&nbsp;<a href="http://www.alchemytheatre.org/privacy.php">Privacy</a>&nbsp;|&nbsp;<a href="mailto:info@jameswebdevelopment.com">Webmaster</a></p>
                <div class="clear">&nbsp;</div>
            </div>
        </div>
    </div>
    I have triple checked that the path to rss_fetch.inc is right, so I know that isn't the issue.

    Any thoughts?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,156
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    You can change your code to this to check it
    PHP Code:
                <?php 
                    error_reporting
    (E_ALL);
                    include (
    'http://www.alchemytheatre.org/magpie/rss_fetch.inc');
                    
    $rss fetch_rss("http://www.alchemytheatre.org/blog/?feed=rss2");
                    if (
    $rss) {
    but I think what is happening is because you are using an absolute path in the include construct. The "http" signals an external file, even if it isn't, and for security reasons PHP is often compiled to not allow this.

    Try using a relative path eg.
    PHP Code:
    include '../magpie/rss_fetch.inc'

  3. #3
    SitePoint Addict MikesBarto2002's Avatar
    Join Date
    May 2006
    Location
    New York City
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Thanks for the advice. I changed the PHP to:

    PHP Code:
                    error_reporting(E_ERROR);
                    include (
    '/magpie/rss_fetch.inc');
                    
    $rss fetch_rss("http://www.alchemytheatre.org/blog/?feed=rss2");
                    if (
    $rss) {
                        echo 
    '<h3><a href="' $rss->items[0]['link'] . '">' $rss->items[0]['title'] . '</a></h3>' "\n";
                        echo 
    '<p>' $rss->items[0]['description'] . '</p>' "\n";
                        echo 
    '<p>Published ' $rss->items[0]['pubdate'] . '.</p>' "\n";
                    } else {
                        echo 
    '<h3>Error:</h3><p>'.magpie_error().'</p>';
                    }
                    @
    ini_restore('error_reporting'); 
    ... and I am still getting the same error...

    Fatal error: Call to undefined function: fetch_rss() in /homepages/38/d134451434/htdocs/wsc134451438/includes/footer.php on line 48

    Any other advice?

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,156
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    I think your path is wrong. If footer.php is in the "includes" folder, for that URL to work the "magpie" folder needs to be in the "includes" folder.
    But http://www.alchemytheatre.org/magpie/rss_fetch.inc suggests that it's not in the includes folder, but a sibling, that is, "next" to it under the main root folder. That's why I put "../" in my example, since I think PHP needs to "back out" of the includes folder before it can go "into" the magpie folder.

    Did you try
    PHP Code:
    include '../magpie/rss_fetch.inc'

  5. #5
    SitePoint Addict MikesBarto2002's Avatar
    Join Date
    May 2006
    Location
    New York City
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That did it! Good eye, and thanks for the advice.


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
  •