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;
}
} 0 1832 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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',
|
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...
|
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():...
|
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:
...
| |
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...
|
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
|
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:...
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
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. ...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |