Advertisement

03.11.2008 at 04:05PM PDT, ID: 23233575
[x]
Attachment Details

redirect standard input to a file, for a command line interactive program

Asked by zzhang2006 in HTTP, Linux, SSH / Telnet Software

I am trying to use the command line Telnet program to get a web page file by doing the
following:

[root@cslinux zezhang]# telnet 10.40.0.2 80
Trying 10.40.0.2...
Connected to mozart.ncsu.edu (10.40.0.2).
Escape character is '^]'.
GET /courses/day08FA.html
... (html file print to screen)

Above works, but I need to have a one-liner command to do this so I could put this in
another program such as perl or php

I have been trying this:
telnet < day

Here  "day"  is a file containing:
open 10.40.0.2 80
GET /courses/day08FA.html

But it didn't work. It got connected to the remote site but second line, GET, was igored.

[root@cslinux zezhang]# telnet < day
telnet> Trying 10.40.0.2...
Connected to mozart.ncsu.edu (10.40.0.2).
Escape character is '^]'.
Connection closed by foreign host.

I hope you, the experts, can provide a solution for this -- run telnet to get an updated html doc from a server, using a a script or whatever.

Thanks in advance.

ZeStart Free Trial
 
Loading Advertisement...
 
[+][-]03.12.2008 at 01:22PM PDT, ID: 21110348

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: HTTP, Linux, SSH / Telnet Software
Sign Up Now!
Solution Provided By: Fredde87
Participating Experts: 2
Solution Grade: B
 
 
[+][-]03.13.2008 at 11:03PM PDT, ID: 21123322

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628