java - Sending HTTP command in browser works, not when sent with httppost -


when in browser send following string control unit have http://192.168.0.215/i_activate/aterm?40~00 , relay activated.

i have tried many variations of following:

httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://192.168.0.215/i_activate/aterm?40~00");  // execute http post request             httpresponse response = httpclient.execute(httppost); 

with html response "fail" unit

i have tried adding 40~00 in many ways (namevaluepair, etc) , encoded in different forms without success sure problem lies there.

any thoughts?

the problem browser sends get request, parameter in url query string, sending post request without body data.

use httpget instead of httppost send get request:

httpclient httpclient = new defaulthttpclient(); httpget httpget = new httpget("http://192.168.0.215/i_activate/aterm?40~00");  // execute http request httpresponse response = httpclient.execute(httpget); 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -