A
A
AlexeyMoshkin2017-04-07 14:10:53
HTTP headers
AlexeyMoshkin, 2017-04-07 14:10:53

How to completely repeat the POST request and get the response body?

I'm trying to repeat a POST request from taobao.com. The request looks like this (copied from Firebug):

curl -X POST \
     --verbose \
     -F 'pageNum=1' \
     -F 'pageSize=15' \
     -F 'auctionTitle=6078971305696895' \
     -F 'itemTitle=6078971305696895' \
     -F 'prePageNo=1' \
     -H ':authority:buyertrade.taobao.com' \
     -H ':method:POST' \
     -H ':path:/trade/itemlist/asyncBought.htm?action=itemlist/BoughtQueryAction&event_submit_do_query=1&_input_charset=utf8' \
     -H ':scheme:https' \
     -H 'accept:application/json, text/javascript, */*; q=0.01' \
     -H 'accept-encoding:gzip, deflate, br' \
     -H 'accept-language:en-US,en;q=0.8,ru;q=0.6,zh-CN;q=0.4,zh;q=0.2' \
     -H 'content-length:90' \
     -H 'content-type:text/html; charset=UTF-8' \
     -H 'cookie:swfstore=156543; v=0; thw=cn; linezing_session=8Ksq2bkiwREbAC1HsfS9yHOe_1491366906150F3SK_1; _tb_token_=3a58513e85be8; uc3=sg2=AHsq3FjG1nMQhPTfmhyMkCD1h3t4lnfZseTd6Uoy8TA%3D&nk2=CMUrwdFnGA%3D%3D&id2=UoYag4MxNj5gFg%3D%3D&vt3=F8dARVMa2S3kPhKu35Y%3D&lg2=V32FPkk%2Fw0dUvg%3D%3D; hng=CN%7Czh-CN%7CCNY; existShop=MTQ5MTQ3NDA1Nw%3D%3D; uss=Vq9lxJ%2BRVM27k5L%2FqP%2BEgKMNebUjW5UEo4tpVR7xLFLTcc6ThJTrlKQgrg%3D%3D; lgc=krasrab; tracknick=krasrab; cookie2=1c3afec85a71301ba405e029a2576790; sg=b80; mt=np=&ci=37_1; cookie1=UtU0eVVgG%2BVJWwz3H2d0270kJYxCnVmeDodOY52EPXU%3D; unb=1748699568; skt=75846e44cfec89a3; t=63f9deae078edb886577e5abeecbcdac; _cc_=V32FPkk%2Fhw%3D%3D; tg=0; _l_g_=Ug%3D%3D; _nk_=krasrab; cookie17=UoYag4MxNj5gFg%3D%3D; cna=FEhqEdPSQEwCAQI/SiGEg1KU; x=e%3D1%26p%3D*%26s%3D0%26c%3D0%26f%3D0%26g%3D0%26t%3D0%26__ll%3D-1%26_ato%3D0; uc1=cookie14=UoW%2BufxMdA8K1A%3D%3D&lng=zh_CN&cookie16=W5iHLLyFPlMGbLDwA%2BdvAGZqLg%3D%3D&existShop=false&cookie21=WqG3DMC9Fb5mPLIQoVXj&tag=5&cookie15=UIHiLt3xD8xYTw%3D%3D&pas=0; whl=-1%260%260%261491474214182; ubn=p; ucn=unsz; l=And3H6BS28WbP/x1oT9bkIqBh2HCmksK; isg=Ajw8T18OSCkF4HxwnLcBZptsDdPd-CvWoW7sSBa-7iee4d9rO0fN72oX575j' \
     -H 'origin:https://buyertrade.taobao.com' \
     -H 'referer:https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm' \
     -H 'user-agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36' \
     -H 'x-requested-with:XMLHttpRequest' \
     --url 'https://buyertrade.taobao.com/trade/itemlist/asyncBought.htm?action=itemlist/BoughtQueryAction&event_submit_do_query=1&_input_charset=utf8'

In the browser, json comes in response to this request, and when you try to repeat it through curl, another response comes up, which cannot be decrypted correctly.
What should I pay attention to successfully retry this request and get the data as in the browser?
Update
I looked at requests on other sites and noticed that when the response encoding is different from utf-8, in the console, when trying to repeat the request through curl, it comes up with about the same nonsense as in the case of the target request.
The target request is encoded gbk, but decoded with the help
iconv -c -f 'gbk' -t 'utf8' body.txt > body-t.txt
does not adequately come out (as well as with the help of various online decoders).
How to get response body in utf-8 format?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Ltonid, 2017-04-07
@AtaZ

I use HttpRequester for firefox, but in the same opera, you can poke in the Copy ALL as curl debug and hope that everything works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question