Automatically collect VIP dog food and vip from a dog flutter Forum

Source: Internet
Author: User

Automatically collect VIP dog food and vip from a dog flutter Forum

Automatically collect VIP dog food from a dog flutter Forum

At the beginning, when I started to reply slowly, I thought about writing a program. Success is always for me.

I spent an hour learning it and wrote it slowly. Although the code is simple, it is enough for my own use.

 

Using System; using System. collections. generic; using System. componentModel; using System. data; using System. drawing; using System. linq; using System. text; using System. windows. forms; using System. net; using System. IO; namespace WindowsFormsApplication1 {public partial class Form1: Form {public Form1 () {InitializeComponent ();} private void Form1_Load (object sender, EventArgs e) {var request = (HttpWebRequest) webRequest. create (" http://bbs.goupu.org/member.php?mod=logging&action=login "); // Create: Create the WebRequest object webBrowser1.Document. encoding = "UTF-8"; // address web page garbled // HttpWebResponse object instance: this class is used to get and operate HTTP response var can be changed to HttpWebResponse var response = (HttpWebResponse) request. getResponse (); // GetResponse: Get a response // construct a data Stream object instance stream = response. getResponseStream (); // GetResponseStream: Get the response stream StreamReader sr = new StreamReader (stream ); // read characters from the byte stream // read from the current position of the stream to the end and display string content = sr in the WebBrower control. readToEnd (); webBrowser1.DocumentText = content; HtmlElement user = webBrowser1.Document. all ["username"]; HtmlElement pass = webBrowser1.Document. all ["password"]; HtmlElement but = webBrowser1.Document. all ["loginsubmit"]; if (user = null | pass = null | but = null) {return;} user. setAttribute ("value", "User Name"); pass. setAttribute ("value", "password"); MessageBox. show (user. toString ();. invokeMember ("Click");} private void button1_Click (object sender, EventArgs e) {HtmlElement text = webBrowser1.Document. all ["message"]; text. setAttribute ("value", "+ 10 bags of dog food"); HtmlElement but = webBrowser1.Document. getElementById ("postsubmit");. invokeMember ("Click");} private void button2_Click (object sender, EventArgs e) {timer1.Enabled = true; timer1.Interval = 1000; timer1.Start (); HtmlElement img = webBrowser1.Document. getElementById ("fastpostmessage"); img. setAttribute ("value", "+ 10 bags of dog food"); HtmlElement but1 = webBrowser1.Document. all ["replysubmit"]; but1.InvokeMember ("Click"); timer1.Stop ();}}}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.