json - Converting cURL into apache httpclient JAVA code -



json - Converting cURL into apache httpclient JAVA code -

i have below curl command want convert using apache httpclient, can help me code

curl -u "uname:pass" -h "content-type: application/json" -h "accept: application/json" -d '{"browsers": [{"os": "windows", "os_version": "7", "browser_version": "8.0", "browser": "ie"}], "url": "http://google.com"}' http://www.testingbrowse/test

thanks

-h 'content-type: application/json'

try below:

mpentity.setcontenttype("application/json");

and "curl -d":

-d '{"metric":"proc.loadavg.15m"}'

you can utilize it:

jsonobject obj = new jsonobject(); obj.put("metric", "proc.loadavg.15m");

but think need array,you can alter jsonarray

there question:how convert “curl --data-urlencode" httpclient?

java json apache curl

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -