[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 147
  • Last Modified:

Beginner problem

Hello:

Supose You have an HTML file (a form) with a textbox and a command button ("Send" button).

The form tag has an Action=http.../url/cgi.cgi" statement.

Te user inputs something in the textbox, presses "send" and voila!.. It's sent.

How can I do exactly the same (send a message) to that cgi (or that URL) automatically without filling the form.... is this possible?
Can I maybe add parameters to the Url?

Did I explain well?

Thanks
0
trillo
Asked:
trillo
  • 4
  • 3
1 Solution
 
trilloAuthor Commented:
Edited text of question.
0
 
chensuCommented:
http.../url/cgi.cgi?para1=value1&para2=value2

para1, para2 are the parameter names and value1, value2 are the values that the user enters.
0
 
jhurstCommented:
It would be better to do something like:
<form name=firstForm action=whatever>
<input type=hidden name=parameter1 value='whatever'>
<input type=hidden name=parameter2 value='whatever'>
<input type=submit>
</form>

Or even, skip the <input type=submit> and use some Javascript of the form:
<body onLoad=firstForm.submit()>

My method is safer because it works whether the form is submitted by either a GET or a POST and also allows for some parameters to be added as user inputs in the form.

The 'append parameters to URL' method works only for scripts that are accepting GET type posts and it is already recommended that these be phased out and replaced by POST actions.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
trilloAuthor Commented:
Sorry, I had to give you more information, but I know very little of CGI, but I know a lot of VC++ and VB (if this helps)

This is my problem: I have a form with some textboxes, the user fills them and clicks "Send". This form uses the POST method!!!

I want to automate this, with C++ or VB. I would like to "fill" virtually the form and virutally "press" the send button.... Actually I don't even want to open the HTML page... I's like to send just a string or open an URL with the rigth parameters.

Chensu's answer was right, and also jhurst's.... Actually Chensu's answer was the one I was looking for, but you're ritght, it does not work with POST methods....
What can I do?
0
 
chensuCommented:
Are you writing a Windows application? Are you using WinInet API functions? If you answer "yes" for both questions, I have got the answer.
0
 
trilloAuthor Commented:
YEEEEEES
0
 
chensuCommented:
HOWTO: Simulate a Form POST Request Using WinInet
http://support.microsoft.com/support/kb/articles/Q165/2/98.ASP
0
 
trilloAuthor Commented:
Well, well, well....
You just made my application send a pager message (by posting the Pin and the message itself to a CGI somwhere on the Internet!!)
Thanks a lot!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now