PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 25th, 2000, 08:43 AM
enygma enygma is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2000
Posts: 38 enygma User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
has anyone had any trouble with warnings about a getbyhostname() call in PHP4 when it can't resolve the hostname? or did I just screw something up?

Reply With Quote
  #2  
Old May 25th, 2000, 04:06 PM
baldwnad baldwnad is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 30 baldwnad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
Send a message via ICQ to baldwnad
Just so you know when I tried to setup the senerio you pointed out, and I too got this error using this code.
<--start code
<?
print(gethostbyname("www.somebunkdomain.com"));
?>
<--end code

<--start error
Warning: Unable to resolve www.somebunkdomain.com in /usr/local/apache/htdocs/php/gethost.php on line 3 www.somebunkdomain.com
<--end error

Reply With Quote
  #3  
Old May 26th, 2000, 10:18 AM
tolik tolik is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 1 tolik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
try whis:

<--start code
<?
$host="www.somebunkdomain.com";
print gethostbyname($host);
?>
<--end code

Reply With Quote
  #4  
Old May 26th, 2000, 12:21 PM
baldwnad baldwnad is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 30 baldwnad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
Send a message via ICQ to baldwnad
With that code you still get the same error. Shouldn't php just dump back instead of an error, "domain not resolved". Maybe it is a configuration error in my php.ini

Reply With Quote
  #5  
Old May 27th, 2000, 03:49 AM
Natrak Natrak is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Location: Oslo, Norway
Posts: 5 Natrak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Bit of an odd error, not sure its supposed to work that way. Here is a work around though:

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<?
@$host = gethostbyname("www.somebunkdomain.com"));
if ($host == "www.somebunkdomain.com") {
print("Couldn't resolve host.");
}
else {
print("Resolved to: $host");
}
?>
[/code]

@ can be very handy to suppress errors

N.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > getbyhostname()

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap