473,698 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Keep getting: php_network_get addresses: 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_get addresses: 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_ur l['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".'Ho st:
'.$a_url['host']."\r\n\r\n") ;
$head = fread($fid, 4096);
fclose($fid);
return preg_match('#^H TTP/.*\s+[200|302]+\s#i', $head);
} else {
return false;
}
}

May 7 '06 #1
0 1836

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

Similar topics

0
1576
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 IPv6 again (for those who are interested, I'm talking about Gentoo Linux) Gentoo's portage system is implemented in python calling rsync to sync with a mirror server. There are rotations (metahostnames with many address records) where portage has...
0
4968
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 I've cobbled together: #getHTML.py ############################################ import urllib import urllib2 proxy_info = {'user':'us3r',
4
2192
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 import cgi and triggers this traceback: Traceback (most recent call last): File "./moin.cgi", line 43, in ? from MoinMoin.request import RequestCGI
1
23756
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 on an other server (more-or-less same config.) the content is not displaid !! with the error message :: Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed:
1
3178
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, proto, canonname, sa = res This led me to the docs that describe the socket.getaddrinfo() method: http://www.python.org/doc/2.4.1/lib/module-socket.html
2
4034
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, this deserves a documentation mention. The "socket" module, given a Unicode string, calls the International Domain Name parser, "idna.py", which has a a whole error system of its own. The IDNA documentation says that "Furthermore, the socket...
5
20988
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 this error: php_network_getaddresses: getaddrinfo failed. When running the same scipt from the CLI (php ./dns.php), i get no
3
8281
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': ipv6_test.c:25: error: storage size of 'hints' isn't known ipv6_test.c:34: warning: implicit declaration of function `getaddrinfo' ipv6_test.c:38: error: dereferencing pointer to incomplete type
1
3862
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, theoretically). This is especially important when behind gateways whose DNS forwarder silently filter AAAA requests. Without AI_ADDRCONFIG, every DNS request has to wait for 4 AAAA request timeouts before it even attempts an A request. Passing...
0
8683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7741
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.