#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    2
    Rep Power
    0

    Saving response in telnet


    Hello! I am perl newbie and trying to write a script that will save the telnet answer into a file after executing command, but the only thing i have successfully made is the output of executing command :RESPONSE: VAR1 =1, instead of full answer, that consists of nearly page.
    Here is that part of code:
    $response = $telnet-print('ZMIO:IMSI=xxxxxxxxxxxxxxxx:;');
    print("RESPONSE: ".Dumper($response));

    ZMIO:IMSI=xxxxxxxxxxxxxxxx:; - is command, that i need to "catch" from telnet. Connection to telnet host and logging is successful. Would be grateful for any help and advising.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,971
    Rep Power
    1225
    If you need to retrieve the output of the command, you need to use the cmd method, not the print method and you need to use an array instead of a scalar.
    Code:
    my @response = $telnet->cmd('ZMIO:IMSI=xxxxxxxxxxxxxxxx:;');
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by FishMonger
    If you need to retrieve the output of the command, you need to use the cmd method, not the print method and you need to use an array instead of a scalar.
    Code:
    my @response = $telnet->cmd('ZMIO:IMSI=xxxxxxxxxxxxxxxx:;');
    thx

IMN logo majestic logo threadwatch logo seochat tools logo