tags:

views:

24

answers:

1

I was given a class that sends a post httpwebrequest to a website and here is the link.. http://joel.net/code/easyhttp.aspx

I was wondering if somebody could give me an example of how to use it for this website z4.invisionfree.com/cotec/index.php?

I'm making an application where a user must log in with their forum account to use it.

A: 

First you'll need to find out a little bit about how the target site accepts authentication data. Ideally, it's just a form with a username and password field that populate a POST request. You need the names of the username and password HTML elements as well as the form action (likely a URL). The URL will be the destination of your request, the names of the fields will be the keys and the values will be, well, the values. Once you have that, send a request and see what comes back.

It may get more complex than that, though. There may be some JavaScript involved on that page or some other fields or hidden fields or anything like that. The site may put in some attempts to prevent what you're doing, and depending on how good those attempts are you may run into some roadblocks.

It looks like a standard enough form, though, so it's worth a shot. It would be something like:

EasyHttp.Send("http://the.action.url", "username=test&password=test")

You may also need to specify the POST verb as a third argument.

David
Well when I tried it, the code that I got was just the log in page, it didnt say wrong password and it didn't log in. I'm not sure if its the website or if I'm not doing it right, do you have an example of a website that I could try this on that would work without any protection?
peppersock
I do not, no. But I imagine you could write one for testing.
David