send json string as request to server using https connection - android

In my android application i would like to send a json object with username and password as string to the server.
Could you please let me know how i can achieve this using https connection.
Please share your valuable suggestions.
Thanks in advance :)

Have you tried a search?
Http Post in android
Android, sending XML via HTTP POST (SOAP)
Http post in Java
Http post in Java with UrlConnection
HttpClient android docs

Related

HTTP request Post to a Server where HTTP body is a JSON dictionary

I have a server I need to POST an http request to. The server is located at http://ec2-54-187-236-58.us-west-2.compute.amazonaws.com
I need to execute a POST /ios/search
I'm given that the HTTP body is a JSON dictionary but I cannot connect to the server itself. Nor am I able to see the JSON object in javascript when I enter the server url in a browser. I am using gson library in android to help me execute the http client request, but am getting the
IOException: Connection to http://ec2-54-187-236-58.us-west-2.compute.amazonaws.com/ios/search refused
What am I missing? Or is there an issue with the server url?

How to use URL Connection instead of HTTPClient in ANDROID to send POST request to PHP?

I was trying to do this using HTTPClient since all the tutorials on the web are using HttpClient. But then I get the message Cannot resolve HTTPClient and that is proabably because it is deprecated since SDK 23. And there are not many tutorials to send POST request using URL Connection.
So can anyone please tell me how to do that ?
Basically let's just say, I ask user to enter the name and when he clicks submit button that is stored in PHP database.
P.S. : I know about ASynk Task, and I know Php and SQL.

How to Get a JSON Response from WordPress Site?

I am using WordPress in my site. The response I am getting from the server is HTML.
What do I need to do to get a server response in JSON format?
Have a look here Android HTTP Request for CakePHP URL , it's not exactly the same but to close to your question.

android - build application to authenticate with web server

I'm trying to make an application that needs authentication :- when user type username and pw in the text boxes it should check with the DB in the server and authenticate.
how can i do this in the android?
can please any one help me??
thank you,
If you are a web developer you can do this authentication very easily. You can follow the following steps,
First, get the username and password from the user and put in the variables.
Create the HTTP connection to the web server (Your data posting URL).
Post the data to the URL with specified data using HTTP Get or Post method(Post is preferable for authentication)
Get the posted value using server side script and do the authentication.
send the response status to the client by using JSON encoding or some other format whether the authentication is succeeded of failure.
Get the response in android and create the InputStream and decode the JSON or some specified encoding format which you done in the server side and shown the response in mobile.
Thats it.

How to use the access token to sign the POST request?

I have an access token and i want to send the POST request and with the some feed in the body. The problem is i am able to get the GET request using the URLConnection but when i use the HttpPost I am not able to send the POST request.
I guess this problem has to do something with not being able to sign the POST request using HttpPost.
Can any one share the sample code for sending the POST request by signing it with the access token?
TIA
I am not really sure, but it sounds like you want to use some kind of OAuth (access tokens, etc.)?! Then http://code.google.com/p/oauth-signpost/ might be a little help for you.

Categories

Resources