Reputation: 7841
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 ?
Upvotes: 47
Views: 65359
Reputation: 34535
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:
An example clipboard content looks like this:
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
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.
Upvotes: 15
Reputation: 1915
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.
Upvotes: 5