Support » Plugin: Get Latest Tweets » [Plugin: Get Latest Tweets] Plugin error

  • Hi

    I’m getting an occasional error using the plugin. The error log from my website is as follows:

    [Tue Mar 08 21:03:22 2011] [error] [client] PHP Warning: file_get_contents( [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/ on line 72

    Line 72 is:
    $json = file_get_contents($url);

    Is there any particular reason that the plugin would fail to get the information from twitter using the file_get_contents function?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Nevermind, I found a solution.

    For anyone who may come across the same problem, change the following lines from:
    $url = “$username.json”;
    $json = file_get_contents($url);
    return $json;

    to this:
    curl_setopt($curl_handle, CURLOPT_URL,”$username.json”);
    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl_handle, CURLOPT_USERAGENT, ‘Twitter’);
    $json = curl_exec($curl_handle);
    return $json;

    I’m having the same problem sometimes. I’ve tried adding your code but this is what I got..

    / over a year ago

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Get Latest Tweets] Plugin error’ is closed to new replies.