Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Posting by telneting to port 80

Posted on 1997-05-27
2
182 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

828 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