How to duplicate a request using wget (or curl) with raw headers? How to duplicate a request using wget (or curl) with raw headers? linux linux

How to duplicate a request using wget (or curl) with raw headers?


Yes, you just need to combine all the headers using --header

wget --header="User-Agent: Mozilla/5.0 Gecko/2010 Firefox/5" \--header="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" \--header="Accept-Language: en-us,en;q=0.5" \--header="Accept-Encoding: gzip, deflate"--header="Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" \--header="Cookie: lang=us; reg=1787081http%3A%2F%2Fwww.site.com%2Fdc%2F517870b8cc7" \--referer=http://www.site.com/dc/517870b8cc7http://www.site.com/download?123456:75b3c682a7c4db4cea19641b33bec446/document.docx

If you are trying to do some illegal download,
it might fail,
is depends on how hosting URL being programmed


Here is curl version:

curl http://www.example.com/download?123456:75b3c682a7c4db4cea19641b33bec446/document.docx \-H "User-Agent: Mozilla/5.0 Gecko/2010 Firefox/5" \-H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" \-H "Accept-Language: en-us,en;q=0.5" \-H "Accept-Encoding: gzip, deflate"-H "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" \-H "Cookie: lang=us; reg=1787081http%3A%2F%2Fwww.site.com%2Fdc%2F517870b8cc7" \-H "Referer: http://www.example.com/dc/517870b8cc7"

In Chrome developer tools, you can use Copy as cURL to catch request as curl.