Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

I would like to find out how I would use both curl and wget to sent an http post to get the hostnames of a few servers. I know am not even given any work of anything I have done, but the reason is that I am really lost, and I do not even know how to start it.

I don't mean to sound like a jackass, but the first place you should always try are man pages whether on the system or on the internet.

From man wget:

Quote:

--post-data=string
--post-file=file

Use POST as the method for all HTTP requests and send the specified data in the request body. --post-data sends string as data, whereas --post-file sends the contents of file. Other than that, they work in exactly the same way. In particular, they both expect content of the form "key1=value1&key2=value2", with percent-encoding for special characters; the only difference is that one expects its content as a command-line paramter and the other accepts its content from a file. In particular, --post-file is not for transmitting files as form attachments: those must appear as "key=value" data (with appropriate percent-coding) just like everything else. Wget does not currently support "multipart/form-data" for transmitting POST data; only "application/x-www-form-urlencoded". Only one of --post-data and --post-file should be specified.

You do not sound like a jackass, not at all. You are trying to help. I had already read the document you are referring to, and did me no good. I googled wget and curl for me to get this done, but I really did not get anything of what I found. That is why I said in my original post that I am not even showing any work.

I know I have to do something like this:
wget --post-data="Hostnames", but after that, I am stuck. I also know I have to configure Apache to handle cgi, but that is something I can do. It is the other part about wget and curl that got me really lost.

If the servers happen to be e-mail servers then it might be far easier to do with telnet to port 25. Just giving Yahoo.com as an example, it is not perfect if you get deferred but you can always go back. In this simplistic example there is no reply if the connection was deferred. So I give you the frame work for the code, more homework can be done from your part to tweak it as needed.