0

I was sending a String using GET in Retrofit and it worked well in my PHP server file.

e.g.

@GET("add.php") Call<Void> getData(@Query("value") String value); 

and this could be retrieved using $_GET['value']. This string was a JSON string converted from an object, say of class Survey.

Now that this string has become very long, I decided to use POST instead of GET otherwise I get a URI too long error.

My new code is this:

@POST("add.php") Call<Void> getData(@Body Survey survey); 

My query is, how can I retrieve this data in my PHP file now (since I am not mentioning the value parameter anymore).

1

1 Answer 1

0

You could add a header to the call like so

@POST("add.php") Call<Void> getData(@Body Survey survey, @Header("value") String value); 

And account for the header in the PHP code

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.