I plan to use the WebRequest class to POST some data to a form, specifically a message and a file.

I don't know the first thing about websites so I was hoping someone could help me out. I know how the message data is supposed to be formatted and how to use the WebRequest and WebResponse classes together, I really just have no idea what key/value pairs to post.

For instance, if I wished to post to this random website: http://www.magpiemobile.com/hc3.asp
what key/value pairs should I post to search, and then how do I retrieve the result?

Recommended Answers

All 3 Replies

I plan to use the WebRequest class to POST some data to a form, specifically a message and a file.

I don't know the first thing about websites so I was hoping someone could help me out. I know how the message data is supposed to be formatted and how to use the WebRequest and WebResponse classes together, I really just have no idea what key/value pairs to post.

For instance, if I wished to post to this random website: http://www.magpiemobile.com/hc3.asp
what key/value pairs should I post to search, and then how do I retrieve the result?

take a look at this

That doesn't answer my question, how do I find the keys & values I need to post to the form?

for instance, assume an HTTP form is on a webpage named "somewebsite.com"

with some http like "method="POST"
<other stuff> name="bla" id = "blaa"
</form>

I send what key with with my value to the form?

You'd have to inspect the form that you're wanting to submit to and get it's 'name' value and also the location of the 'action' that the form is sending to. Most of the time the form requests data from inputs, like this:

$_POST['name']
$_POST['email']

Or any other variation of superglobals (such as $_GET). As long as you pass the correct values into the action file, it should work fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.