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.

Share:
15,941
SMUsamaShah
Author by

SMUsamaShah

Working at Jagex.

Updated on June 04, 2022

Comments

  • SMUsamaShah
    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
      Maxim Gueivandov over 13 years
      Need the whole picture here. How does your search.asp relate to Result.asp? Does the code snippet you provided reside in Result.asp or Search.asp? What does the num() function do? And why "There is no way to see the result for all students"?
    • SMUsamaShah
      SMUsamaShah over 13 years
      Sorry 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
    Linus Kleen over 13 years
    And where is the POST request sent to? A URL, perhaps? And where's the correlation between Content-Type and an HTTP request method?
  • SMUsamaShah
    SMUsamaShah over 13 years
    I 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
    Roland Illig over 13 years
    Yes, 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
    SMUsamaShah over 13 years
    Yes, c# does provide facility to send http request and also to parse html there is a library.