• Hey,

    A plug-in I am developing uses

    $request = new WP_Http;

    to make a connection to another url on the site, which loads calendar data relevant to each blog page that loads, but it takes forever. I tried curl earlier and that wasn’t a huge help either. This server doesn’t seem to load dynamic full url includes.

    Anyway, how would you load external data, such as for a PHP Calendar script, if you wanted your blog posts to load quickly?

    It’s brutal for me right now. Granted, I have work to do to make sure I use conditionals so I load only one connection request per page (it’s in development and there are 3 connection requests right now so maybe that’s adding to load time)

    Here is what I do:

    if( !class_exists( ‘WP_Http’ ) )
    include_once( ABSPATH . WPINC. ‘/class-http.php’ );

    $url1=”https://www.site1.com/page1.html”;
    $url2=”…/page2.html”;
    $url3=”…/page3.html”;

    $request = new WP_Http;
    $result = $request->request( $url1 );
    $result2 = $request->request( $url2 );
    $result3 = $request->request( $url3 );

    And then I do a replace function where I tell $content=str_replace
    (“[token_in_page]”,$result[body],$content)

    and it loads the external data of the url.

    How can I do this same thing, replace a token with external url data, without a horrendous load time?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How To Load External Url's Data Without Slow Load?’ is closed to new replies.