473,395 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Keep getting: 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 so apologies if this
is a server question not a PHP question - but as the issue is
manifesting itself only in my PHP I thought I'd ask here too.

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;
}
}

May 7 '06 #1
0 1818

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bernhard Schmidt | last post by:
Hello, sorry for bothering, I'm not a programmer and I don't do much python, I'm more a networking guy trying to get his favourite linux distribution to update through the shiny new protocol...
0
by: Matt | last post by:
I'm trying to get the HTML data off of a webpage. Let's say for the sake of argument it's the python homepage. I've googled around and found some examples that people said worked. Here's what...
4
by: edcdave | last post by:
I'm trying to get MoinMoin 1.5.4 running with Python 2.3.4 (installed from an SCO Skunkworks binary). Python 2.3.4 (#1, Aug 27 2004, 18:22:39) on sco_sv3 One of the MoinMoin modules attempts to...
1
by: Henry16 | last post by:
Never seen such a situation ! Do you have once faced this problem ? We use a fsockopen to retrieve a content from a URL . The content is dispalid corretly on a page on one of our servers. But...
1
by: mirandacascade | last post by:
I noticed the following lines from the connect() method of the HTTPConnection class within httplib: for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): af, socktype,...
2
by: John Nagle | last post by:
Here's a strange little bug. "socket.getaddrinfo" blows up if given a bad domain name containing ".." in Unicode. The same string in ASCII produces the correct "gaierror" exception. Actually,...
5
by: _q_u_a_m_i_s's | last post by:
Hy, i have a problem with PHP 5.1.6 I have a script containing something like this: $f=fsockopen("www.site01.com",80,$errNo,$errStr); var_dump($f); When accessing this from apache, i get...
3
by: Nathan | last post by:
Hi, I'm trying to do some network programming, but when I use 'struct addrinfo' or getaddrinfo, I see errors: gcc --std=c99 -Wall ipv6_test.c -o it ipv6_test.c: In function `main':...
1
by: Karl Chen | last post by:
I've discovered that since glibc 2.3.2, getaddrinfo(3) supports a useful flag called AI_ADDRCONFIG. It turns off AAAA lookups if the machine isn't configured for IPv6 (and similarly for IPv4,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.