2
I’m trying to send an array with some elements in a post to a url.
I called 'Webbroser' method, passed the parameters, but still I had no idea how to finish implementing.
Follows my code:
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("MINHA_URL");
request.Method = "POST";
request.Accept = "application/json";
request.UserAgent = "curl/7.37.0";
request.ContentType = "application/x-www-form-urlencoded";
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
string data = "browser=Win7x64-C1|Chrome32|1024x768&url=http://www.google.com";
streamWriter.Write(data);
}
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
var lista = new string[]
{
info.nome,
info.idade,
info.estado= "H",
//DAQUI PRA BAIXO JÁ É PRÉ-DEFINIDO
info.regiao,
info.tipousuario = "X",
info.formulario = "0",
info.t = "+",
info.v = "",
info.pop = "",
info.t= "",
info.p= "",
info.t= "x",
info.r= "x",
info.e= "2",
info.f= "n",
info.id= ""
};
webBrowser1_DocumentCompleted(lista, null);
}
#region inputs
private void textBox1_TextChanged(object sender, EventArgs e)
{
info.estado= textBox1.Text;
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
info.nome= textBox2.Text;
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
info.idade= textBox3.Text;
}
#endregion
I don’t understand what your doubt is.
– Leonel Sanches da Silva
So gypsy. I have a URL that will receive a post from an array. What I want is to send this post that is in button1_Click for the webBrowser1_DocumentComplete method.
– Vinícius
And then what? What happens?
– Leonel Sanches da Silva
I want this url, run with the parameters that was sent to it.
– Vinícius