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 Link to comment https://forums.phpfreaks.com/topic/58382-need-help-trying-to-connect-to-telnet/ 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? Link to comment https://forums.phpfreaks.com/topic/58382-need-help-trying-to-connect-to-telnet/#findComment-289472 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.... Link to comment https://forums.phpfreaks.com/topic/58382-need-help-trying-to-connect-to-telnet/#findComment-289473 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.