I am trying to write a program (C #) that can log in and create a new topic in the VBulletin forums. I tried 2 ways:
1) Use HttpWebRequest . Login is complete. However, a new thread is not created. This is the post code:
public static void CreateNewThread(string url,string fId, string title, string message, string tag) { url += "newthread.php?do=postthread"; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); //string result = ""; string values = "subject=" + title + "&message=" + message + "&tag=" + tag + "&do=postthread" + "&f=" + fId + "&s=" + "" ; req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; req.ContentLength = values.Length; ServicePointManager.Expect100Continue = false; // prevents 417 error using (StreamWriter writer = new StreamWriter(req.GetRequestStream(), Encoding.UTF8)) { writer.Write(values); } HttpWebResponse c = (HttpWebResponse)req.GetResponse(); }
When executing the code above, no protection was created!
2) Use the WebBrowser control:
webBrowser1.Document.GetElementById("navbar_username").InnerText = "admin"; webBrowser1.Document.GetElementById("navbar_password").InnerText = "123";
But I canβt imagine, because it does not have a name / id, and the login button is the same! Please tell me how to submit a form without the name / id of the form and the name / id of the button?
Thanks!
Respectfully,
source share