473,785 Members | 2,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

conflicting gethostbyname behaviors

I seem to be getting conflicting gethostbyname behavior on different
servers. Before going into detail, here's the script I'm using:

<?
$address = $HTTP_SERVER_VA RS['REMOTE_ADDR'];
$rev = implode('.',arr ay_reverse(expl ode('.', $address)));

$lookup = "$rev.l1.spews. dnsbl.sorbs.net ";
echo gethostbyname($ lookup);
echo '<br />';
echo $lookup;
?>

On server A, the output I get is as follows:

176.115.112.70. l1.spews.dnsbl. sorbs.net
176.115.112.70. l1.spews.dnsbl. sorbs.net

On server B, the output I get is this:

195.69.95.204
176.115.112.70. l1.spews.dnsbl. sorbs.net

As I understand it, server A's output is the correct output - not
server B's.

Server A is running PHP Version 4.4.1 with Apache/1.3.34 while server B
is running PHP Version 4.3.11 with Apache/2.0.52. I'd like the above
script, however, to work just as well on server A as it does on server
B.

Any ideas as to how I might go about doing this or what the problem is?
Any help would be appreciated - thanks!

May 12 '06 #1
1 1727
yawnmoth wrote:
I seem to be getting conflicting gethostbyname behavior on different
servers. Before going into detail, here's the script I'm using:

<?
$address = $HTTP_SERVER_VA RS['REMOTE_ADDR'];
$rev = implode('.',arr ay_reverse(expl ode('.', $address)));

$lookup = "$rev.l1.spews. dnsbl.sorbs.net ";
echo gethostbyname($ lookup);
echo '<br />';
echo $lookup;
?>

On server A, the output I get is as follows:

176.115.112.70. l1.spews.dnsbl. sorbs.net
176.115.112.70. l1.spews.dnsbl. sorbs.net

On server B, the output I get is this:

195.69.95.204
176.115.112.70. l1.spews.dnsbl. sorbs.net

As I understand it, server A's output is the correct output - not
server B's.

Server A is running PHP Version 4.4.1 with Apache/1.3.34 while server B
is running PHP Version 4.3.11 with Apache/2.0.52. I'd like the above
script, however, to work just as well on server A as it does on server
B.

Any ideas as to how I might go about doing this or what the problem is?
Any help would be appreciated - thanks!


Hi,

Did one of them change recently their name maybe?
PHP caches lookups. (Or rather Apache does if I understand it well).

What MIGHT help are some usercontributed notes on www.php.net:

Two possibilities:
1) restart Apache (in case of caching DNS-problem)
2) Do not use gethostbyname, but use 'dig' instead.

Just go to www.php.net and look up the function for details.

Regards,
Erwin Moller

May 12 '06 #2

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

Similar topics

5
6636
by: yawnmoth | last post by:
using the gethostbyname function seems to noticeably slow down pages. some of the comments in php.net's gethostbyname entry suggest using a version that caches the result, but those versions also only speedup subsequent calls to gethostbyname - the first call is still as slow as ever. so is there anything i can do to speed this up? perhapes i can just implement a function equivalent to gethostbyname using fsockopen, or something?
0
6032
by: Eric Brunel | last post by:
Hi all, I just compiled Python 2.3.2 on Linux Mandrake 8.0, upgrading from Python 2.1. I have one problem that I can't figure out: when I wanted to get "the" IP address of the current host with Python 2.1, I did: Python 2.1.1 (#12, Apr 10 2002, 17:52:08) on linux2 Type "copyright", "credits" or "license" for more information. >>> import socket
1
7146
by: Fortepianissimo | last post by:
I've tried using socket.setdefaulttimeout(timeout) to set the default timeout to 'timeout' for all sockets. The part that's not clear to me, is that if this will affect socket.gethostbyname(). In my observation the timeout setting did not affect the DNS lookup. It might be my misunderstanding of the semantics here: would
5
2741
by: ruroma | last post by:
Hello, I have one problem, and can think of two possible solutions but I can't manage to make them work. I'm open to other suggestions if you thik is better. The main function calls sendSocket, but I don't know how to tell it where to send the socket. ( I think I'm messing it up with pointers)
1
3815
by: Glen Conway | last post by:
Hi, I'm trying to use the gethostbyname function from wsock32.dll and failing dismally Has anyone got a successful implementation of this in VB.NET? My ulitimate goal is to resolve NetBIOS names to IP Addresses. I can use the framework DNS features if a DNS server is present on the network but this cannot use WINS if no DNS server is available. Any help or pointers are apprecatiated. Here is the code I've managed to do so far. I've...
1
7224
by: Quentin Carbonneaux | last post by:
Hello, I'm writing a little program which has to get a FQDN on his stdin and return the IP on stdout, we can do it easily with gethostbyname call but I would like to set up a timeout to this blocking system call. So I read texts about this and I planed to use a hack with alarm and setjmp/longjmp. My program works until there is a timeout, when it occurs, all the gethostbyname calls which follow fail, backtrace in gdb give me this : #0 ...
2
5579
by: Andrew DeFaria | last post by:
I've been having problems with my ISP. One way it seems to manifest itself is that I can not reach or contact my ISP's DNS servers. IOW a simply nslookup google.com will fail. So I tried writing a script that would monitor this. The script calls gethostbyname for google.com every 15 minutes and logs the status. When gethostbyname fails however it never comes back. My ISP and internet connection may come back and nslookup at the command...
9
1639
by: patrik.nyman | last post by:
I have this templates to mark up hyphenation over line breaks: <xsl:template match="reg"> <xsl:apply-templates select="@orig"/> </xsl:template> <xsl:template match="reg/@orig"> <xsl:call-template name="html-hyphens"/> </xsl:template>
18
3662
by: aj | last post by:
I have the following snippet of code. On some platforms, the delete calls works, on Linux, it core dumps (memory dump) at the delete call. Am I responsible for deleting the memory that gethostbyname allocated? struct hostent *lHostInfo; lHostInfo = gethostbyname(ipHost.c_str()); memcpy(&(lDestAddr.sin_addr), lHostInfo->h_addr_list, lHostInfo- delete lHostInfo;
0
9480
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10330
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
10153
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
6740
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
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
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
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.