Jorge B.
Jorge B.

Reputation: 1213

How to send data form php server to android

I need to create a protocol (an API) to send data (encrypted) from my php server (my web site) to a specific Android phone. Or send data from Android phone to my php server. I need both methods. Data security is essential.

(by clicking in a button on web site or by clicking in a button in my Android phone)

I have searched here but i only see questions about sending data without concern of security.

Can anyone explain me how to do that?

I do pretend to know:

    • how to discover my Android phone in php side?
    • how can I send data from php to Android?
    • how can I send data from Android to php?
    • how can I use a secure connection?
    • how can I encrypt and decrypt my data?

Edited: My urgente problem is: how to get data from php (safely) in android side? Give me an example...

Thanks

Upvotes: 0

Views: 1450

Answers (1)

pgchamberlin
pgchamberlin

Reputation: 36

To communicate securely between an Android device and a PHP server I would use HTTPS. This article on the Android Developer site will help with your research in that department:

http://developer.android.com/training/articles/security-ssl.html

Using HTTPS will preclude you having to develop your own protocol.

Answering your bullet points:

  1. You'd need to either set up a web server on the Android device so the PHP app can contact it, or have the Android device periodically call home to the PHP app. The second option is much, much more straightforward.
  2. HTTPS
  3. HTTPS
  4. HTTPS
  5. This is built into SSL / TLS / HTTPS, you won't need to handle it.

I hope that helps :-)

Upvotes: 1

Related Questions