sending username and password with hostname in socket programming with php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ranishobha21@gmail.com

    sending username and password with hostname in socket programming with php

    Dear All,

    I am sending the code below.i have not specifies the host name.i want
    to send command to server and get the response from it.but it doesnt
    work.when i connect with the telnet using ssh to remote machine it
    works.


    i type telnet hostname->username->password and then i can login to
    the
    remote machine.how can i send hostname with username and password to
    remote machine in france


    <?php


    $cmnd= "abc";
    $host="....";
    $port="12345";
    $socket = socket_create(A F_INET, SOCK_STREAM, SOL_TCP) ;
    socket_connect( $socket,$host,$ port) ;


    socket_write($s ocket, $cmnd) ;


    $ser_messegeg=s ocket_read ($socket, 1024);
    echo $ser_messege;
    socket_close($s ocket) ;
    }
    ?>


    Please help me


    Regards
    shobha

Working...