Support » Plugins » [Plugin: TweetMe] Help with Error

  • Resolved dhinz

    (@dhinz)


    I get teh following error when I submit a new post. I believe it is something on my server and not related to tweetme other than it is using a function my server doesnt’ like. Can someone tell me if:
    1. it is in fact an error on “my side”
    2. ideas on what I need to do to fix my server (even though I probably can’t as I’m at the mercy of the hosting company)

    The error is:

    Warning: file_get_contents(): URL file-access is disabled in the server configuration in …/K9AM/blog/wp-content/plugins/tweetme/tweetme.php on line 76

    Warning: file_get_contents(http://bit.ly/api?url=http://k9am.com/blog/2009/03/29/testing-tweetme/): failed to
    open stream: no suitable wrapper could be found in …/K9AM/blog/wpcontent/
    plugins/tweetme/tweetme.php on line 76

    The post to twitter includes the title but the shortened URL is missing (obviously due to this errant call)
    Thanks in Advance
    dan

    http://wordpress.org/extend/plugins/tweetme/

Viewing 7 replies - 1 through 7 (of 7 total)
  • dagon-design

    (@dagon-design)

    You are correct. It has to do with the configuration of your server.

    file_get_contents allows you to get the contents of a file (obviously). It is sometimes possible to supply it a URL, for example:

    $data = file_get_contents(‘http://example.com/whatever’);

    But some servers are configured (for various reasons) to now allow this, but to only allow file_get_contents to be used on files on the server, using the relative or absolute path to the file, for example:

    $data = file_get_contents(‘myfile.txt’);

    Unless you have control over the apache configuration on your web server and can change the setting yourself, or a dedicated server, it is unlikely that your host would make this change, as they may have their own reasons for having the restriction in place.

    The only option would then be to modify the script so that it does not use the URL to fetch the file (assuming the file in question is on your server).

    dagon-design

    (@dagon-design)

    I took a look at the code of that plugin. Here is the function responsible:

    function tweetme_bitly_link($id) {
      $link = get_permalink($id);
    	return file_get_contents('http://bit.ly/api?url=' . $link);
    }

    Now that I look, I see that it is indeed trying to pull data from a remote server. To use the API at bit.ly

    You can try to see if your host will make the settings change, but if not, another alternative would be to modify the plugin so that it uses another method, such as CURL, but CURL would have to be installed on your server as well.

    Here is an example function to mimic the file_get_contents function using CURL:

    http://snipplr.com/view/4084/curl-replacement-for-filegetcontents/

    Hope that helps!

    Thread Starter dhinz

    (@dhinz)

    DD-
    Thanks for the confirmation and suggestions.

    I’m hosted on goDaddy and they claim that they don’t disable or hamper any of the php functions. That being said, I decided to look in the php configuration file that THEY created on account setup and could see that there was a line that had disabled the URL access for the fle_get_contents function.

    A quick edit of the php configuration file changing “OFF” to “ON” and I’m in business! Thanks again for the help.

    i changed servers and redownloaded tweetme but it tells me my password is wrong when i know it’s the right one.

    please advise,

    steve

    This thread is very closely related to this one.

    I had the same problem with auth, which is now fixed, I thnk by the latest release that come out yesterday.

    However, The tweet isn’t working, and I get this in my error log:

    [Wed Apr 15 11:35:30 2009] [error] Posting: New Blog Post: My New Guitar and Music Website! http://bit.ly/2kLZ0i
    [Wed Apr 15 11:35:31 2009] [error] Error: 400

    Any ideas? Anyone lese having the same problem? I wonder if this is the code, or another server side issue. twitter’s api documentation states that a 400 is returned when the rate-limit is exceeded…

    All working nicely now. New release fixed it. Thanks!

    Hi All,

    I have just released 1.2.3 which hopefully fixes both the login error, and the fact that some people where not seeing anything on twitter.

    @dhinz can I suggest you install my RevCanonical plugin, which means that you generate and host your own short urls, and tweetme will use these instead. A win win situation.

    Duncan

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: TweetMe] Help with Error’ is closed to new replies.