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 Link to comment https://forums.phpfreaks.com/topic/8625-problem-with-domain-to-ip-address-translator/ 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 Link to comment https://forums.phpfreaks.com/topic/8625-problem-with-domain-to-ip-address-translator/#findComment-31636 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? Link to comment https://forums.phpfreaks.com/topic/8625-problem-with-domain-to-ip-address-translator/#findComment-31641 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 Link to comment https://forums.phpfreaks.com/topic/8625-problem-with-domain-to-ip-address-translator/#findComment-31652 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.