mattonline Posted July 4, 2007 Share Posted July 4, 2007 I'm kind of new to php, and i want to connect to telnet on whois.nic.uk port 43 how would i go about doing this? i know i need sockets but im not sure how to create them Quote Link to comment Share on other sites More sharing options...
mattonline Posted July 4, 2007 Author Share Posted July 4, 2007 i've been trying to work this out.... code below <? $domain = 'internet.co.uk'; $fs = fsockopen('whois.nic.uk', 43, $errno, $errstr, 60); if (!$fs) { fclose($fs); } else { fputs($fs, "$domain\r\n"); $line = fgets($fs, 1024); echo $line; } ?> i want to input a domain and then for it to open the telnet and send the domain to the telnet... is this correct? Quote Link to comment Share on other sites More sharing options...
mattonline Posted July 4, 2007 Author Share Posted July 4, 2007 <?php $domain = 'internet.co.uk'; $sourceip = 'xx.xx.xx.xx'; // ip you want to bind to $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($sock, $sourceip); socket_connect($sock, 'dac.nic.uk', 2043); // Write $request = "$domain\r\n"; socket_write($sock, $request); //Read reply // Close socket_close($sock); ?> sorry this is then the created socket.... 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.