Solved

Posting by telneting to port 80

Posted on 1997-05-27
2
177 Views
Last Modified: 2013-12-25
One of my cgi scripts telnet's to port 80 of a server with an intent to POST something..
The script name is post.cgi and the variable that needs to be passed is "numb"
How would I post the numb string to post.cgi
First I try telneting to port 80
then I type "POST /cgi-bin/post.cgi HTTP/1.0"

What do I do next to post numb=1 to post.cgi?

Thanks
0
Comment
Question by:chiefarcher
2 Comments
 
LVL 2

Accepted Solution

by:
mkornell earned 100 total points
ID: 1828107
You output to telnet should look like:

----begin output----
POST /cgi-bin/post.cgi HTTP/1.0
Content-length: ?????

numb=some_url_encoded_data
----end output----

(Of course, don't send the lines starting with '----' :-)

After the initial POST line, you need to send appropriate header lines, of the form "Header: header information"

You really, _really_ should send a Content-length: header.  This tells the server how much data (in bytes) you are going to be sending.  Some servers require this to be set, and others, if it is not set, will read all passed.

Other headers you might want to set are User-Agent: and Host:.

After the header lines, you need to send a blank line. This tells the server on the other end that you've finished sending headers and are about to send data.

Then, send your POST data. How the data will be interpreted is totally up to the receiving end, but typically it will be expecting a name1=value1&name2=value2 format.  (Sounds like this is case for your needs.)

For a full description of the HTTP protocol, refer to RFC 1945 (HTTP/1.0) or RFC 2068 (HTTP/1.1).  These can be found at http://info.internet.isi.edu/1/in-notes/rfc

Just curious: Is your post.cgi script written in Perl? If it is, there are Perl libraries that will take care of all the HTTP overhead for you.  Check out the libwww bundle at CPAN ( http://www.perl.org/CPAN ).

--mark;
0
 

Author Comment

by:chiefarcher
ID: 1828108
Beautiful
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now