J
jason
i am trying to run basic program for apache http components and i
cannot for the life of me figure out how to include this library
within my program.
if someone is willing to help me while i struggle through this and
just help me solve this question it would be largely appreciated.
i honestly have no idea what i am doing/doing wrong and feel as if i
am beating my head against the wall
i am downloading binary with deps
including the folder as a source folder in my package properties. and
no luck.
code i am trying to run:
package hackthissiteapp1;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
public class Main
{
public static void main(String[] args) throws Exception {
HttpClient client = new HttpClient();
GetMethod getPage = new GetMethod("http://
www.hackthissite.org");
client.executeMethod(getPage);
PostMethod postLogin = new PostMethod("http://
www.hackthissite.org/pages/index/index2.php");
NameValuePair[] data = {
new NameValuePair("txt_username", "MYUSERNAME"),
new NameValuePair("txt_password", "MYPASSWORD"),
new NameValuePair("btn_submit","Login")
};
postLogin.setRequestBody(data);
client.executeMethod(postLogin);
//this is a request to a page that requires authentication
GetMethod getPage2 = new GetMethod("http://
www.hackthissite.org/missions/basic/");
client.executeMethod(getPage2);
System.out.println(getPage2.getResponseBodyAsString());
}
}
cannot for the life of me figure out how to include this library
within my program.
if someone is willing to help me while i struggle through this and
just help me solve this question it would be largely appreciated.
i honestly have no idea what i am doing/doing wrong and feel as if i
am beating my head against the wall
i am downloading binary with deps
including the folder as a source folder in my package properties. and
no luck.
code i am trying to run:
package hackthissiteapp1;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
public class Main
{
public static void main(String[] args) throws Exception {
HttpClient client = new HttpClient();
GetMethod getPage = new GetMethod("http://
www.hackthissite.org");
client.executeMethod(getPage);
PostMethod postLogin = new PostMethod("http://
www.hackthissite.org/pages/index/index2.php");
NameValuePair[] data = {
new NameValuePair("txt_username", "MYUSERNAME"),
new NameValuePair("txt_password", "MYPASSWORD"),
new NameValuePair("btn_submit","Login")
};
postLogin.setRequestBody(data);
client.executeMethod(postLogin);
//this is a request to a page that requires authentication
GetMethod getPage2 = new GetMethod("http://
www.hackthissite.org/missions/basic/");
client.executeMethod(getPage2);
System.out.println(getPage2.getResponseBodyAsString());
}
}