monroe wrote:It's simply a matter of looking at the HTML Forms and actions. Then dealing with the cookies returned.
To make a new post manually, you need to:
1) Login
2)Fill out and submit the new topic form.
Let's look at 1). If you view at the HTML source for the login screen, you will see that that there is a form with an action URL, hidden fields, and visible fields for user and password.
To programatically log in, you need to use something like the HTTPClient PostMethod to create the same input that a user would. Something like the code below but done so it matches the jForum login form:
Then you need to deal with the information that has been returned. In particular, you need to get the session id associated with that login. Generally this is done by your Appserver returning a session cookie with this information. The HTTP client package as ways to get this from the response.
To do 2), just look at the new topic form's action and fields. Then generate a new post request with your new topic information, including the Cookies received from 1).
If you need to do more than one topic, just keep using the session cookie and doing more posts.
If you want, you can pro grammatically log out the user, but since the session will time out, this is not needed.
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|