CalumT Posted April 28, 2006 Share Posted April 28, 2006 Hey there PHP freaks,I'm trying to build a basic domain to IP address translator, I have this code:[code]<?php$site=addslashes(strip_tags($_POST['site']));$ipaddress = gethostbyname $site; echo "The IP address of $site is $ipaddress"; ?>[/code]But It returns this error when I submit the form I created:[i]Parse error: parse error, unexpected T_VARIABLE in /home/calumla/public_html/processip.php on line 97[/i]Line 97, with my HTML is this:[code]$ipaddress = gethostbyname $site;[/code]All help is appriciated, thanks!~Calum Quote Link to comment Share on other sites More sharing options...
craygo Posted April 28, 2006 Share Posted April 28, 2006 gethostbyname requires enclosed ().so it should be[code]$ipaddress = gethostbyname ('$site');[/code]Ray Quote Link to comment Share on other sites More sharing options...
CalumT Posted April 28, 2006 Author Share Posted April 28, 2006 [!--quoteo(post=369548:date=Apr 28 2006, 07:16 AM:name=craygo)--][div class=\'quotetop\']QUOTE(craygo @ Apr 28 2006, 07:16 AM) [snapback]369548[/snapback][/div][div class=\'quotemain\'][!--quotec--]gethostbyname requires enclosed ().so it should be[code]$ipaddress = gethostbyname ('$site');[/code]Ray[/quote]Thanks Ray, but there's still an error, If I put in Microsoft.com, I get this[i] The IP address of microsoft.com is $site[/i]Any ideas? Quote Link to comment Share on other sites More sharing options...
kayess2004 Posted April 28, 2006 Share Posted April 28, 2006 [!--quoteo(post=369553:date=Apr 28 2006, 10:28 PM:name=-Calum-)--][div class=\'quotetop\']QUOTE(-Calum- @ Apr 28 2006, 10:28 PM) [snapback]369553[/snapback][/div][div class=\'quotemain\'][!--quotec--]Thanks Ray, but there's still an error, If I put in Microsoft.com, I get this[i] The IP address of microsoft.com is $site[/i]Any ideas?[/quote]Hi,Remove the quotes[code]$ipaddress = gethostbyname($site);[/code]HTH Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.