Support » Plugins and Hacks » [Plugin: Get Latest Tweets] Error on Line 72

[Plugin: Get Latest Tweets] Error on Line 72

  • motoxer4533


    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] 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] 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_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);
    return $json;


  • The topic ‘[Plugin: Get Latest Tweets] Error on Line 72’ is closed to new replies.