N
N
Nikita Sklyuev2012-05-24 23:27:06
Java
Nikita Sklyuev, 2012-05-24 23:27:06

Getting POST request data?

Hello dear hackers.
I just ran into one problem, I can’t understand with what parameters the POST data is sent by a request from the program.
I sniffed my traffic, received a packet with data, and it is not clear with which key this data is sent on a POST request.
Here is the request itself:

POST /external/xml/ HTTP/1.1
Content-Length: 238
Connection: Keep-Alive
Accept-Encoding: gzip
Accept-Language: ru-RU,en,*
User-Agent: Mozilla/5.0
Host: **************
Content-Type: application/x-www-form-urlencoded

<?xml version="1.0" encoding="windows-1251"?><client><call>************************</call></client>

There is nothing more in the request!
As you can see, the headers are sent and then the data immediately, without a key!
The data is identical in different sniffers.
I just want to make an analogue of a desktop application for Android, and because of this misunderstanding of the situation, I got into a dead end . Thank you in
advance!

Answer the question

In order to leave comments, you need to log in

6 answer(s)
R
Roman, 2012-05-25
@trilodi

The code is something like this:

HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://site.com/url");

StringEntity requestEntity = new StringEntity("<?xml version=\"1.0\" encoding=\"windows-1251\"?>..."); // можно использовать ByteArrayEntity или InputStreamEntity если данные берутся из файла
requestEntity.setContentType("application/x-www-form-urlencoded");
httpPost.setEntity(requestEntity);
HttpResponse response = httpClient.execute(httpPost);

W
WebByte, 2012-05-25
@WebByte

You answered your own question - the data is sent in the request body.
The fact that you are used to the fact that in it they usually go something like this:
foo=bar&foo1=bar1
does not mean that you cannot send without such formatting.
Keywords to search for: RAW POST, POSTDATA, etc.

V
Vladimir Dubrovin, 2012-05-25
@z3apa3a

You can get the content of the request, for example, via $HTTP_RAW_POST_DATA
BUT:
Your content of the POST request does not match
Content-Type: application/x-www-form-urlencoded
If you want to post exactly XML, then it should be
Content-Type: text/xml
If you want to post exactly as form data and access by field name, and not HTTP_RAW_POST_DATA, then encode them appropriately.

1
1nd1go, 2012-05-25
@1nd1go

It's not entirely clear what key you're talking about?
First, you better then send the data via https. Then the transport will be secure. Without keys.
If you are talking about some kind of oAuth token or some other signature, then show the code that sends your post request. In the WNezRoS example , I don't think there will be any keys either, since I don't see anything being inserted for that...

S
SCINER, 2012-05-25
@SCINER

If in php, then you can get this data in this way:

$request = file_get_contents('php://input');

M
mace-ftl, 2014-12-25
@mace-ftl

file.php?id=165&sid=1088c7be4e5127532d93

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question