WordPress.org

Ready to get started?Download WordPress

Forums

Get Latest Tweets
Error on Line 72 (1 post)

  1. motoxer4533
    Member
    Posted 1 year ago #

    Just updating the post here: http://wordpress.org/support/topic/plugin-get-latest-tweets-plugin-error?replies=3

    The issue is something like this:

    [Tue Mar 08 21:03:22 2011] [error] [client 188.221.109.83] PHP Warning: file_get_contents(http://twitter.com/status/user_timeline/stephenfry.json) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request\r
    [Tue Mar 08 21:03:22 2011] [error] [client 188.221.109.83] in /home/sites/martyn-roberts.co.uk/public_html/cycleafrica/wordpress/wp-content/plugins/get-latest-tweets/get-latest-tweets.php on line 72

    To fix this, I changed the following lines (near line 72):

    $json = file_get_contents($url);
    return $json;

    to this:

    $curl_handle=curl_init();
    curl_setopt($curl_handle, CURLOPT_URL, $url);
    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Fiddler');
    $json = curl_exec($curl_handle);
    curl_close($curl_handle);
    return $json;

    http://wordpress.org/extend/plugins/get-latest-tweets/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.