-1

I've written a PHP script to get data from a mysql database and convert this into JSON data. I can then display this on my webserver.

I want to JSON data to my Android Application. I understand I need to edit my PHP script to include GET and POST.

However, to send data to the application, should I be using GET or POST, or can I use either?

Security is not a concern here.

collision934
  • 31
  • 1
  • 8
  • Possible duplicate of [What is the difference between POST and GET?](http://stackoverflow.com/questions/3477333/what-is-the-difference-between-post-and-get) – user Feb 23 '16 at 01:42

2 Answers2

1

If security is not a concern then you should use GET method

MinFu
  • 343
  • 1
  • 13
1

You should select the appropriate method for the task. As it seems that you just want to get (in opposite to store) some information, use GET.

HTTP defines methods (sometimes referred to as verbs) to indicate the desired action to be performed on the identified resource. ... Often, the resource corresponds to a file or the output of an executable residing on the server. ...

GET

The GET method requests a representation of the specified resource. Requests using GET should only retrieve data and should have no other effect. (This is also true of some other HTTP methods.) ...

POST

The POST method requests that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI. The data POSTed might be, for example, an annotation for existing resources; a message for a bulletin board, newsgroup, mailing list, or comment thread; a block of data that is the result of submitting a web form to a data-handling process; or an item to add to a database.

PUT

The PUT method requests that the enclosed entity be stored under the supplied URI. If the URI refers to an already existing resource, it is modified; if the URI does not point to an existing resource, then the server can create the resource with that URI.

DELETE

The DELETE method deletes the specified resource.

PATCH

The PATCH method applies partial modifications to a resource.

Source: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods

Community
  • 1
  • 1
jakub_jo
  • 1,087
  • 11
  • 20