Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter danazz09

    (@danazz09)

    Resolved the issue with some help of a friend.

    Needed to set the feed timeout parameter to be longer then 10seconds.

    This is done in the feed.php file which is found in the wp-includes folder.
    $feed->set_timeout(60);

    Should look like this:

    /**
    * Build SimplePie object based on RSS or Atom feed from URL.
    *
    * @since 2.8
    *
    * @param string $url URL to retrieve feed
    * @return WP_Error|SimplePie WP_Error object on failure or SimplePie object on success
    */
    
    function fetch_feed($url) {
       require_once (ABSPATH . WPINC . '/class-feed.php');
       $feed = new SimplePie();
       $feed->set_feed_url($url);
       $feed->set_cache_class('WP_Feed_Cache');
       $feed->set_file_class('WP_SimplePie_File');   $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200, $url));
       do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
    
       $feed->set_timeout(60);
    
       $feed->init();
       $feed->handle_content_type();
       if ( $feed->error() )
           return new WP_Error('simplepie-error', $feed->error())
    
       return $feed;
    }

    Hi, I’m getting a similar issue, where I get WP HTTP Error: Operation timed out after 10001 milliseconds with 0 bytes received…..

    If I refresh the page it then works. Just wondering what you asked your host and what they did to fix the issue.

    So is the issue on my servers side or is it from the yahoo pipes server side where the information is being sent too slow?

    My url is http://www.dansportznet.com

    Thread Starter danazz09

    (@danazz09)

    I have since added:

    if (!is_wp_error( $afl_link ) ) {
    
    				$maxitems = $afl_link->get_item_quantity(20);
    				}else{
    					echo $afl_link->get_error_message();
    				}

    under the line :
    $afl_link = fetch_feed('http://pipes.yahoo.com/pipes/pipe.run?_id=8116da6bea0aacd7aceecaec5124dd1b&_render=rss');

    It seems that the issue is with a timeout. I am getting the following error message now.

    WP HTTP Error: Operation timed out after 10001 milliseconds with 0 bytes received

    This is doing my head in. Would appreciate any help if somebody has come across this before.

    Thread Starter danazz09

    (@danazz09)

    Thanks for your help. Works just as I wanted it to! 🙂

    Thread Starter danazz09

    (@danazz09)

    Alchymyth thanks a lot. That has resolved my issue!

    At the same time though, it has now brought up another one. While I can now use 1 single php page as a template and grab the custom fields to dynamically change the parameters, I think I still need a separate php file for each page indicating what page to look for the information on. This is the code I mean:

    <?php
    				$page_id = 1384; //ID of page from your WP admin panel
    				$page_data = get_page( $page_id ); 
    
    				echo $page_data->post_content; // Show page content
    				$url = get_post_meta($page_id, 'address', true);
    
    	?>

    I can’t just say $page_id = get_page)($page_id); can I, it will not know where to look for a particular page will it.

    By the way I am new to WordPress and have just been learning off tutorials and forums.

    Thread Starter danazz09

    (@danazz09)

    Sorry, this is the first time I’ve ever posted on this forum. Did not know about the code thingy.

    Here is what I have. The loop is actually closed. The loop is working fine when I put the actual URL in rather then using the custom field. It is just when I replace the actual URL with the custom field that it then just prints out the custom field url on the web page rather then showing the contents of that url.

    Code again :
    `<?php

    $page_id = 1391; //ID of page from your WP admin panel
    $page_data = get_page( $page_id );
    echo $page_data->post_content; // Show page content

    $url = get_custom_field_value(‘address’, true); //custom field
    ?>

    <?php include_once(ABSPATH. WPINC. ‘/feed.php’);

    $afl_link = fetch_feed($url); //making use of custom field rather then having fetch_feed(‘http://feeds.feedburner.com/example&#8217;);

    $maxitems = $afl_link->get_item_quantity(23);
    $afl_items = $afl_link->get_items(0,$maxitems);

    if (!rss_items) {
    echo “There are no Feeds”;
    } else {

    $i = 0;
    foreach ($afl_items as $item) {
    ?>

    //Echo out the RSS feed details
    <p>get_permalink(); ?>” target=”_blank”>
    <?php echo $item->get_title(); ?>
    <p>

    ……… }
    …?>’

    Thread Starter danazz09

    (@danazz09)

    Anybody got any idea about this?

    Thread Starter danazz09

    (@danazz09)

    By the way, when I replace the $url custom field with an actual working url, it works as expected, printing out the permalinks and titles of each feed.

Viewing 8 replies - 1 through 8 (of 8 total)