Send POST request via URL
15,941
An HTTP POST request cannot be sent by using just an URL. (Except for the special case that there are no form fields and that the server doesn't care about the Content-type
header.)
You should use an external program like wget
or curl
, which both can send either GET or POST requests.
Comments
-
SMUsamaShah almost 2 years
There is an asp page on which i enter my Rollno and press submit, next page shows my result. Below is the source of form of the page.
<form name="form1" method="post" action="Result.asp"> <input name="Rollno" type="text" id="RollNo" size="15" maxlength="15"> <input type="submit" name="Submit" value=" Search " onClick="return num();"> </form>
There is no way to see the result for all students therefore i want to loop through all roll numbers to see my position. But i am unable to do it by writing search.asp?Rollno=123456
How to send the request via url so that i can loop through all numbers?
-
Maxim Gueivandov over 13 yearsNeed the whole picture here. How does your
search.asp
relate toResult.asp
? Does the code snippet you provided reside inResult.asp
orSearch.asp
? What does thenum()
function do? And why "There is no way to see the result for all students"? -
SMUsamaShah over 13 yearsSorry for that, search.asp is the page where i write roll no, and Result.asp is the page where number is displayed. Only the person who knows his/her roll no can find his result. There is no option to see the score of others. Fortunately roll numbers are incremental.
-
-
Linus Kleen over 13 yearsAnd where is the POST request sent to? A URL, perhaps? And where's the correlation between
Content-Type
and an HTTP request method? -
SMUsamaShah over 13 yearsI want to make a simple application which will loop through the results, is it possible to do that with c# + curl or wget?
-
Roland Illig over 13 yearsYes, it is possible, though I don't know how easy it will be. But when you are using C# in the first place, you should definitely have a look if the C# API provides a way to open an HTTP connection and maybe parse HTML. Using an external program usually involves more work.
-
SMUsamaShah over 13 yearsYes, c# does provide facility to send http request and also to parse html there is a library.