Need help, passing parameters through URL .NET

Discussion in 'Programming' started by jfontestad, Apr 26, 2012.

  1. #1
    Hey,

    I was wondering if anyone can help me figure out how I can pass variables to this site: https://www.onapi.gob.do/servicios/signos.aspx

    I looked at the source and used the names which are within the form for each field, but that didn't help.

    Reason that I am looking to do this, is that I work for a company and we have to manually submit potential product names to this institution to see if they're available or not, and even then it's only about 1% that are and furthermore only about 1% of that 1% gets approved. So I am looking for a way to automate this process a little, but I can not figure out the name of the parameters that are passed in order to create a script that can automatically check to see if the names are at least available.

    I am trying to pass the parameters through a URL.

    ex: https://www.onapi.gob.do/servicios/...A/PS&TipoBusqueda=Texto&txtparametro=lustatin

    Thanks in advanced.
     
    jfontestad, Apr 26, 2012 IP
  2. Scarrfo

    Scarrfo Peon

    Messages:
    59
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I can only give an idea, you should use HttpWebRequest. This can be done with a Desktop app or web app.

    I'm going to show a simple example to give the idea but you can google ".net post to web form" to get a better grasp.



    Note the bold print


    private void OnPostInfoClick(object sender, System.EventArgs e)
    { string strId = UserId_TextBox.Text; string strName = Name_TextBox.Text; ASCIIEncoding encoding=new ASCIIEncoding();
    string postData="userid="+strId; postData += ("&username="+strName); byte[] data = encoding.GetBytes(postData); // Prepare web request...
    HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://localhost/MyIdentity/Default.aspx");
    myRequest.Method = "POST"; myRequest.ContentType="application/x-www-form-urlencoded";
    myRequest.ContentLength = data.Length; Stream newStream=myRequest.GetRequestStream(); // Send the data.
    newStream.Write(data,0,data.Length); newStream.Close(); }
     
    Scarrfo, Apr 26, 2012 IP