using System;
using System.Configuration;
using System.IO;
using System.Net;
using System.Text;

namespace AutoVote
{
    class Program
    {
        static void Main(string[] args)
        {
            long id = long.Parse(ConfigurationManager.AppSettings["id"]);
            long phone = 13000000000;
            int count = 0;
            for (int i = 0; i < 1000; i++)
            {
                id++;
                phone++;
                VoteById(id, phone, ref count);
            }
            Console.WriteLine(string.Format("成功投票{0}张", count));
        }

        private static void VoteById(long id, long phone, ref int count)
        {
            //SelectID1=11&
            string data = string.Format("SelectID4=47&dh={1}&sfz={0}&submitLogin.x=67&submitLogin.y=7", id, phone);
            byte[] requestBuffer = System.Text.Encoding.GetEncoding("gb2312").GetBytes(data);
            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://www.ntradio.net/sqtp/vote_doIpzuo.asp");
            request.Method = "POST";
            request.Headers.Add(HttpRequestHeader.Cookie, "ASPSESSIONIDQQSRBATB=PBJGAFHCKNGJOFDJDBPEGNPG;");
            request.Referer = "http://www.ntradio.net/sqtp/indexzuo.asp";
            request.ContentLength = requestBuffer.Length;
            request.ContentType = "application/x-www-form-urlencoded";
            request.UserAgent = "Mozilla/5.0";
            request.UseDefaultCredentials = true;
            using (Stream requestStream = request.GetRequestStream())
            {
                requestStream.Write(requestBuffer, 0, requestBuffer.Length);
                requestStream.Flush();
                requestStream.Close();
            }

            WebResponse response = request.GetResponse();
            StringBuilder sb = new StringBuilder();
            using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("gb2312")))
            {
                string str = reader.ReadToEnd();
                sb.Append(str);
                reader.Close();
            }

            if (sb.ToString().Contains("恭喜您"))
            {
                count += 1;
                System.Console.WriteLine("成功投票" + count.ToString());
            }
        }
    }
}

Recently Restful and ROA are buzzwords,Here are some resources about REST.

http://blog.wekeroad.com/2007/12/06/aspnet-mvc-using-restful-architecture/

http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven

http://www.javaeye.com/topic/295195

http://www.cnblogs.com/xiedan/archive/2009/10/21/1587336.html

Book about REST

http://oreilly.com/catalog/9780596519209/?CMP=AFC-ak_book&ATT=RESTful%20.NET

http://oreilly.com/catalog/9780596529260/

http://oreilly.com/catalog/9780596801694/

This post is password protected. To view it please enter your password below:


There are many javascript frameworks,like JQuery,Ext,YUI and so on. Most of the frameworks take JS as OO(Object Oriented) just like advanced language, Some common methods are necessory to make it possible.

(more…)

I had looking for a free blog which hosting wordpress for some hours.Finally I found Blogoose,Which I think is best on internet,so I decide to take it as my primary english blog. (more…)

Welcome to Blogoose – Blogging Communities. This is your first post. Edit or delete it, then start blogging!