I saw a video of a guy using the
connection.setRequestProperty("content-type", "aplication/x-www-urlencoded");
But I did not understand how it works, especially "aplication/x-www-urlencoded"
.
I saw a video of a guy using the
connection.setRequestProperty("content-type", "aplication/x-www-urlencoded");
But I did not understand how it works, especially "aplication/x-www-urlencoded"
.
Content-Type is an HTTP Header that identifies the data structure that will be sent / received from the server, and is language independent.
In this case: Content-Type: application / x-www-urlencoded means that the structure of the data sent / received is a query key string = value separated by &
Ex:
nome=John&sobrenome=Doe
Another example: Content-Type: application / json means that the data will be sent / received following the JSON structure:
{ "nome": "John", "sobrenome": "Doe"}
More on: link