php_network_getaddresses: getaddrinfo failed

Discussion in 'PHP' started by Joseph S, Aug 31, 2008.

  1. #1
    <? include('http://www.host/page.php');?>
    Code (markup):
    It returns a "Temporary failure in name resolution" so I cannot use php include. Is there any piece of code I can use to check if include is possible and if it is, include, else do something else?

    I know I can use iframe, but I am willing to code it with PHP.

    Thanks.
     
    Joseph S, Aug 31, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    Does this page contain PHP scripting from another host? mostly hosts doens't allow those scripts.

    If not, you can use readfile or other ways to read external files.
     
    EricBruggema, Sep 1, 2008 IP
  3. Freewebspace

    Freewebspace Notable Member

    Messages:
    6,213
    Likes Received:
    370
    Best Answers:
    0
    Trophy Points:
    275
    #3
    there is no way to read external files

    if it's a internal file

    you should do like this

    <? include('http://www.host.com/page.php');?>
    Code (markup):
     
    Freewebspace, Sep 1, 2008 IP
  4. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Is this file on your server or on a different server? if it's on your server, you should use something like

    include '/home/username/www/path/to/file/file.php';
    PHP:
    if you are wanting to read the contents of another sites page, use

    $content = file_get_contents('http://www.site.com/page.php');
    PHP:
     
    JAY6390, Sep 1, 2008 IP
  5. lanmonkey

    lanmonkey Active Member

    Messages:
    549
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #5
    you should use the full local path as in /home/public_html/../../file.php because if you do it using a URL you will be using another apache thread when you dont heed to.

    you will probably also need to enable open basedir in php.ini
     
    lanmonkey, Sep 1, 2008 IP