Keep Getting Error: php_network_getaddresses: getaddrinfo failed

This is a discussion on Keep Getting Error: php_network_getaddresses: getaddrinfo failed within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi - I am using this url_exists function: to check whether files exist on other peoples webservers (before allowing my users ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-07-2006
StevePBurgess@gmail.com
 
Posts: n/a
Default Keep Getting Error: php_network_getaddresses: getaddrinfo failed

Hi - I am using this url_exists function: to check whether files exist
on other peoples webservers (before allowing my users to add the site
to their directory of rss feeds). On my current shared hosting (running
Apache 1.3.29 Red Hat Linux PHP 4.3.10) the function works perfectly.
On my new, Plesk VPS system (running Apache 2.0.51 Fedora PHP 4.3.10)
it doesn't work - I get this error:

php_network_getaddresses: getaddrinfo failed

If the is the IP address then the error does not occur but if I try to
resolve the IP address using gethostbyname("webaddress") it simply
returnes the webaddress (e.g. bbc.co.uk returns bbc.co.uk - not the IP
address).

It looks like the issue relates to the DNS server hence putting the
query here in apache configuration - apologies if it turns out to be a
specific PHP problem. The DNS Server is BIND.

Many thanks.

Here is the function:

function url_exists($url) {
$a_url = parse_url($url);
if (!isset($a_url['port'])) $a_url['port'] = 80;
$errno = 0;
$errstr = '';
$timeout = 5;
if(isset($a_url['host']) &&
$a_url['host']!=gethostbyname($a_url['host'])){
$fid = fsockopen($a_url['host'], $a_url['port'], $errno,
$errstr, $timeout);
if (!$fid) return false;
$page = isset($a_url['path']) ?$a_url['path']:'';
$page .= isset($a_url['query'])?'?'.$a_url['query']:'';
fputs($fid, 'HEAD '.$page.' HTTP/1.0'."\r\n".'Host:
'.$a_url['host']."\r\n\r\n");
$head = fread($fid, 4096);
fclose($fid);
return preg_match('#^HTTP/.*\s+[200|302]+\s#i', $head);
} else {
return false;
}
}

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:47 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0