Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Apr 2007
    Posts
    10

    Default Accessing WHM via PHP - php_network_getaddresses: getaddrinfo failed

    Warning: file(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/ismywebs/public_html/access.php on line 4

    Warning: file(http://...@ismywebsite.com:2086): failed to open stream: Success in /home/ismywebs/public_html/access.php on line 4
    This error has been bugging me for just short of a month! Originally I discovered it in a script for a free hosting manager (I am trying to build a free host). I isolated the exact code that is attempting to access the WHM below:

    Code:
    <?php
    $file = file("http://user:pass@@ismywebsite.com:2086");
    print_r($file);
    ?>
    It doesn't work. Yet when I go to http://userass@ismywebsite.com:2086 myself I can access it fine. To fully test that file() is working on the server -with URLs - I created:

    Code:
    <?php
    $file = file("http://www.ismywebsite.com/");
    print_r($file);
    $file = file("http://user:pass@ismywebsite.com:2086");
    print_r($file);
    ?>
    Try it at http://www.ismywebsite.com/access.php

    The contents of my site display perfectly but the WHM is still inaccessible.

    Please help me. This is the biggest roadblock I have ever faced in the development of my free host dream and please don't let it fail. Thanks a lot for your time and help.

  2. #2
    Member
    Join Date
    May 2005
    Posts
    100

    Default

    Why not use cURL instead of file? If you don't have that library, just use the fsock library. The file functions don't work so well for http-type things, and might break from weird characters of authentication methods.

  3. #3
    Member
    Join Date
    Apr 2007
    Posts
    10

    Default

    This line was originally in a script for the Free Host Manager from http://www.fhm-script.com/ using file_get_contents() instead - which returns the same error.

    It appears no others have these errors. And I do not know how to create CPanel accounts on my own - so I would need to use a ready-made script for that.

    But maybe I can update the entire code to use fsock instead of file() if it works. What code would I use to do what I am trying to do above?

    Code:
    $fp = fsockopen("user:pass@ismywebsite.com", 2086, $errno, $errstr);
    Like that? Then what?

  4. #4
    Member bpat1434's Avatar
    Join Date
    Oct 2004
    Location
    Columbia, MD
    Posts
    71

    Default

    To read information you'd use something like

    Code:
    $fp = fsockopen('www.imywebsite.com', 2086, $errno, $errstr, 30);
    $html = '';
    
    while(!feof($fp))
      $html .= fread($fp, 1024);
    At that point, everything that WHM would output is put into the $html variable. In order to send headers and stuff, you'd have to use the fputs() function to send information to the server.

  5. #5
    Member
    Join Date
    Apr 2007
    Posts
    10

    Default

    Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/ismywebs/public_html/access.php on line 7

    Warning: fsockopen(): unable to connect to www.imywebsite.com:2086 in /home/ismywebs/public_html/access.php on line 7

    Warning: feof(): supplied argument is not a valid stream resource in /home/ismywebs/public_html/access.php on line 10

    Warning: fread(): supplied argument is not a valid stream resource in /home/ismywebs/public_html/access.php on line 11
    Still not working...

  6. #6
    Member
    Join Date
    Apr 2007
    Posts
    10

    Default

    Please help me...

  7. #7
    Member
    Join Date
    Nov 2006
    Posts
    19

    Default

    I have a similar / same problem. You can repeat this by using SOAP cURL, file_get_contents, etc. Some servers are ok for me (yahoo.com is ok, but google.com does not load - I get a Hostway underconstruction page)

    Any fixes. Is this a DNS resolution problem?

Similar Threads & Tags
Similar threads

  1. Accessing delpop function via PHP
    By devendradb in forum E-mail Discussions
    Replies: 1
    Last Post: 05-12-2010, 03:23 AM
  2. Accessing AWSTAT IN CPANEL using php
    By francis_tudlong in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 08-31-2009, 08:39 AM
  3. rvsitebuilder gives php_network_getaddresses
    By its_joe in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 08-09-2009, 11:55 AM
  4. New (temp) Account Copied... php_network_getaddresses errors
    By jvanv8 in forum New User Questions
    Replies: 2
    Last Post: 09-02-2008, 11:37 AM
  5. Replies: 2
    Last Post: 01-26-2006, 12:25 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube