Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view the whole raw http request?

How to send HTTP request for forms ? Here is the thing , I can view the result from "http://www.educationboardresults.gov.bd/lite/index.php" .

But I want to know in which format the browser sent the request so I can automate it. I saw this question "View HTTP headers in Google Chrome?"

But in chrome When I view the page , I can see only the header , there is no indication of how the elements of the forms were submitted.

Basically I want to write a program such that , for a given set of roll number such as 100000-110000, I would collect the result , manipulate the result as my wish. For this I need to know the format browser sent the information request , that is the raw http request. so that I can send that in C too.

I know some socket programming in C. So I will be able to code up the thing myself. I just need to know in which format I have to decorate the string which I would be sending to the server ! POST "something something" , what would be here instead of something ?

like image 387
Tamim Addari Avatar asked Aug 13 '14 16:08

Tamim Addari


People also ask

How do I view raw HTTP postman?

You can right click on the main Postman window > Inspect element. In the Network tab, you'll be able to see the request when you click the Send button. Clicking on the request in the Network tab will show you the response payload.

What is a raw HTTP request?

The Raw HTTP action sends a HTTP request to a web server. How the response is treated depends on the method, but in general the status code and the response headers are returned in variables defined as part of the page load options.

What is raw HTTP header?

Raw means that the header is not URL-encoded, whereas if the word "raw" is omitted, the header is encoded. For example: $header = 'http://www.mywebsite.com?


2 Answers

In the Chrome DevTools, under the Network section, right-click on the line you are interested in and select the appropriate type of copy from the context menu:

enter image description here

An example clipboard content looks like this:

Copy as cURL

curl 'https://stackoverflow.com/posts/25291052/editor-heartbeat/answer' \
  -H 'authority: stackoverflow.com' \
  -H 'pragma: no-cache' \
  -H 'cache-control: no-cache' \
  -H 'sec-ch-ua: "Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"' \
  -H 'accept: application/json, text/javascript, */*; q=0.01' \
  -H 'x-requested-with: XMLHttpRequest' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36' \
  -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \
  -H 'origin: https://stackoverflow.com' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-dest: empty' \
  -H 'referer: https://stackoverflow.com/questions/25291052/how-to-view-the-whole-raw-http-request' \
  -H 'accept-language: en,pl;q=0.9,es;q=0.8' \
  -H 'cookie: prov=8a6c8983-02cd-669c-367d-61ff657f111e; _ga=GA1.2.1494864357.1594965293; __qca=P0-618917173-1594965293194; __gads=ID=86eda01ab828f223:T=1594965534:R:S=ALNI_MZ6mV2_oJewkg2Z7wubZCCK_dFI0Q; gadsTest=test; sgt=id=9653ade3-9325-4178-a074-d2ff62012690; _gid=GA1.2.480664929.1621240994; acct=t=PYE1PDFUezJZN%2b7eJHz4uQtgdkSgmrsw&s=NfLIf8YH%2f3FPmxGoaPDa2w5sB%2bzihVsv' \
  --data-raw 'fkey=39c9ef4d76e1af44087482fe5f9802ac518ce9725a5323015874a7e69a493dea&clientCount=4' \
  --compressed

Copy as fetch

fetch("https://stackoverflow.com/posts/25291052/editor-heartbeat/answer", {
  "headers": {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en,pl;q=0.9,es;q=0.8",
    "cache-control": "no-cache",
    "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
    "pragma": "no-cache",
    "sec-ch-ua": "\"Google Chrome\";v=\"89\", \"Chromium\";v=\"89\", \";Not A Brand\";v=\"99\"",
    "sec-ch-ua-mobile": "?0",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin",
    "x-requested-with": "XMLHttpRequest"
  },
  "referrer": "https://stackoverflow.com/questions/25291052/how-to-view-the-whole-raw-http-request",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "fkey=39c9ef4d76e1af44087482fe5f9802ac518ce9725a5323015874a7e69a493dea&clientCount=4",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

We also have the option to retrieve a specific response or all requests from the list at once using one of the "Copy all as ..." options.

Try it yourself and choose the most suitable option for you.

This site inspired my answer.

like image 190
simhumileco Avatar answered Oct 05 '22 22:10

simhumileco


If there is no way to see these information native in chrome you could allways fall back to use a web debugging proxy (f.e. fiddler) or a web penetration testing proxy (f.e. owasp ZAP).

Then no information which are send or receive can be hidden. You can see everything in raw format. In case of ZAP you have also the ability to record all communication in raw format as text files and you can intercept requests and responses for debugging purpose.

like image 38
snap Avatar answered Oct 05 '22 23:10

snap