Support » Fixing WordPress » Temporary failure in name resolution

  • First thing this morning I go to my blog and notice these errors appearing several times at the top of several posts on my blog:

    Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/account/public_html/sitefolder/blog/wp-includes/class-snoopy.php on line 1142

    It doesn’t appear on every post though and I don’t know why this suddenly just started happening. I haven’t changed anything. I saw some mentions of it elsewhere on this forum and it was apparently attributed to Twitter Tools. So I have disabled that plug but there is not change, the errors still appear.

    It’s also revealing the structure of my folders so that anyone can look inside blog/wp-includes which I am not really happy about either. I suppose there is a way of blocking http access to this folder via my .htaccess file but that’s a minor detail. I’d rather not have the error occur in the first place.

    I;ve started disabling other plugins but nothing seems to stop the error from occurring and I don’t see how this can all happen over night while I am asleep without any changes being made by me.

    Have I been hacked into?

Viewing 6 replies - 1 through 6 (of 6 total)
  • esmi


    Forum Moderator

    Without knowing where your site is, who can say…

    I am working with my webhost to resolve this as it seems that when the PHP function fsockopen() throws errors it is because of firewall restrictions on the outgoing connections.

    I’ve changed nothing on my blog to cause this problem so I assume my host has tightened their firewall settigns or something.

    Things were worse than I thought, I realised I was unable to post to my blog, it kept throwing those same errors:

    Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/account/public_html/sitefolder/blog/wp-includes/class-snoopy.php on line 1142

    After much troubleshooting with a support guy it seems that it is because they have changed something. This is what he said:

    We have disabled allow_url_fopen  php configuration  on the server due to its hacking vulnerabilities , very few applications require it, and by disabling it we  will prevent exploitation of PHP remote include vulnerabilities.

    Applications that do require it can be modified to use cURL instead.

    Please contact your developer and modify the code in your filename.php as follows.

    Instead of:

    $file_contents = file_get_contents(‘ ‘);
    // display file
    echo $file_contents;

    Use this:

    `$ch = curl_init();
    $timeout = 5; // set to zero for no timeout
    curl_setopt ($ch, CURLOPT_URL, ‘ ‘);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $file_contents = curl_exec($ch);
    // display file
    echo $file_contents;

    I don’t really know what that means or what file to change.

    He then said he’d re-enabe the allow_url_fopen php configuration but ssaid that it actually made no difference and that the problems were actually being caused by bad coding on my blog. But I hadn’t changed anything so I am not sure what he was referring to exactly.

    I then did what I should have done at first seeing this problem. I turned all my plugins off. The problem went away. One by one I turned them back on. Until I got to

    image caption

    This was the culprit!

    I am not sure what it is about this particular plugin that suddenly has a disagreement with my blog but leaving it off solves the problem. But I like this plugin and would lke to use it so I looked at the code. I recognise the call to


    that was mentioned in the error message.

    I don’t know what all this means but I am hoping that someone else might be able to help. What is it about this plugin that suddenly stuffed up my blog with this errors and firewall restrictions on the outgoing connections?


    (PS: I know it would be more helpful if I posted a link to the site but I’d rather not make the address of the site public….sorry.)

    More on this ongoing problem. I wasn’t just image caption plugin as I had suspected. That reduced the errors, but didn’t solve the issue entirely. After spending many hours on this with support I am told:

    We can see the warning on page

    Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/pyramidt/public_html/pyramidofman/blog/wp-includes/class-snoopy.php on line 1142

    We do not allow “allow_url_fopen” and “allow_url_include” on our servers due to server security.
    But you can use a functionin curl instead of “file_get_contents()” which will perform the same task for you.

    Does anyone know how to implement this?

    Does this just go in the class-snoopy.php file?

    Have you considered switching to a different web host? You shouldn’t have to put up with fsockopen errors or edit core WordPress files to get WordPress working (which you’ll have to do with every WordPress update).

    I have considered that yes. I have had more than my share of pain with this host. They are and I would avoid them like the plague for many reasons, not just this one.

    However, I have been reading up on curl versus fopensock and it seems that many webhosts disable the fsockopen function due to it’s vulnerabilities being exploited by hackers.

    So I would have to find a host that has not disabled fsockopen and hope that they don’t disable it in future.

    Do you know of any that fit those critera?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Temporary failure in name resolution’ is closed to new replies.