fsockopen() and telnet

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Lynn

    #1

    fsockopen() and telnet


    I'm considering using a PHP command line script to retrieve reports from a
    Linux system. My only source for the report is via telnet.

    Has anybody here used fsockopen() to interactively script a telnet session
    in PHP?

    If so, what problems did you have to overcome. If not, does this sound
    do-able?



    Tom Lynn
    --------

  • Michael Fuhr

    #2
    Re: fsockopen() and telnet

    Tom Lynn <tomlynn97@hotm ail.com> writes:
    [color=blue]
    > I'm considering using a PHP command line script to retrieve reports from a
    > Linux system. My only source for the report is via telnet.[/color]

    Do you mean that you telnet to the system, get a shell, and generate
    the report by executing a command or sequence of commands? Or do
    you mean that you use the telnet client to connect to a certain
    port and the report is generated automatically?
    [color=blue]
    > Has anybody here used fsockopen() to interactively script a telnet session
    > in PHP?
    >
    > If so, what problems did you have to overcome. If not, does this sound
    > do-able?[/color]

    Depending on what you're doing, you might need to implement the
    TELNET protocol, which might involve more than you care to do.

    Is there a reason for using PHP? If you need to mimic an interactive
    shell session, then consider using expect, which was designed for
    exactly that sort of thing.

    --
    Michael Fuhr

    Comment

    • Tom Lynn

      #3
      Re: fsockopen() and telnet

      On 30 Nov 2003 13:14:33 -0700, mfuhr@fuhr.org (Michael Fuhr) wrote:
      [color=blue]
      >Tom Lynn <tomlynn97@hotm ail.com> writes:
      >[color=green]
      >> I'm considering using a PHP command line script to retrieve reports from a
      >> Linux system. My only source for the report is via telnet.[/color]
      >
      >Do you mean that you telnet to the system, get a shell, and generate
      >the report by executing a command or sequence of commands? Or do
      >you mean that you use the telnet client to connect to a certain
      >port and the report is generated automatically?[/color]

      I get the report using the 1st method you mention. I telnet, login and
      then issue a request for the report which is echoed back to the screen.
      [color=blue]
      >[color=green]
      >> Has anybody here used fsockopen() to interactively script a telnet session
      >> in PHP?
      >>
      >> If so, what problems did you have to overcome. If not, does this sound
      >> do-able?[/color]
      >
      >Depending on what you're doing, you might need to implement the
      >TELNET protocol, which might involve more than you care to do.
      >
      >Is there a reason for using PHP? If you need to mimic an interactive
      >shell session, then consider using expect, which was designed for
      >exactly that sort of thing.[/color]

      Expect sounds like a decent way to go. I'm not prepared to implement any
      protocols. Are there any expect like pear packages?

      Tom

      Comment

      • Michael Fuhr

        #4
        Re: fsockopen() and telnet

        Tom Lynn <tomlynn97@hotm ail.com> writes:
        [color=blue]
        > On 30 Nov 2003 13:14:33 -0700, mfuhr@fuhr.org (Michael Fuhr) wrote:
        >[color=green]
        > >Is there a reason for using PHP? If you need to mimic an interactive
        > >shell session, then consider using expect, which was designed for
        > >exactly that sort of thing.[/color]
        >
        > Expect sounds like a decent way to go. I'm not prepared to implement any
        > protocols. Are there any expect like pear packages?[/color]

        I did a few quick searches on pear.php.net and www.google.com and
        didn't find anything.

        --
        Michael Fuhr

        Comment

        • Tom Lynn

          #5
          Re: fsockopen() and telnet

          On 30 Nov 2003 23:44:13 -0700, mfuhr@fuhr.org (Michael Fuhr) wrote:
          [color=blue]
          >Tom Lynn <tomlynn97@hotm ail.com> writes:
          >[color=green]
          >> On 30 Nov 2003 13:14:33 -0700, mfuhr@fuhr.org (Michael Fuhr) wrote:
          >>[color=darkred]
          >> >Is there a reason for using PHP? If you need to mimic an interactive
          >> >shell session, then consider using expect, which was designed for
          >> >exactly that sort of thing.[/color]
          >>
          >> Expect sounds like a decent way to go. I'm not prepared to implement any
          >> protocols. Are there any expect like pear packages?[/color]
          >
          >I did a few quick searches on pear.php.net and www.google.com and
          >didn't find anything.[/color]

          I have come across a PHP application framework that implements telnet.

          It's called Plankton and can be found at


          Tom Lynn
          --------

          Comment

          Working...