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.
Ze
Start Free Trial