Where can I check my httpPost method?

Could you advise a server against which I can check my class, which sends and receives a response to the httpPost () method?

+5
source share
1 answer

Heres free website:

http://www.snee.com/xml/crud/posttest.html

You can send a message in http://www.snee.com/xml/crud/posttest.cgiwith two parameters, putting them as your key

fnameand lnameand displays the answer.

Here is the whole source of form

<html> 
<title>POST test</title> 
<body> 

<h1>posttest.html</h1> 

<form action="posttest.cgi" method="post"> 
<p>This form invokes an existing script called posttest.cgi:</p> 

<p>first name <input type="text" name="fname" size="40"/></p> 
<p>last name <input type="text" name="lname" size="40"/></p> 

<input type="submit" value="  go  " /> 

</form> 

</body></html>

Roughly you can go to this site and check it. Hope that helps

Here is an example of Android code:

try{
HttpClient client = new DefaultHttpClient();
HttpPost request = new HttpPost(
"http://www.snee.com/xml/crud/posttest.cgi");

List<NameValuePair> postParameters = new ArrayList<NameValuePair>();

postParameters.add(new BasicNameValuePair("fname", "First name"));
postParameters.add(new BasicNameValuePair("lname", "Last name"));

UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(
postParameters);

request.setEntity(formEntity);

HttpResponse response = client.execute(request);

in = new BufferedReader(new InputStreamReader(response.getEntity()
.getContent()));

StringBuffer sb = new StringBuffer("");
String line = "";
String NL = System.getProperty("line.separator");
while ((line = in.readLine()) != null) {
sb.append(line + NL);
}
in.close();}catch(Exception ex){}
+7
source

All Articles