⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formmain.cs

📁 类似google的源代码
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;

namespace GooglePRQuery
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string responseFromServer = "";
            PRCalculate.CheckSum cs =new PRCalculate.CheckSum();
            string s = cs.CalculateChecksum(txtUrl.Text);

            try
            {
                HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create(@"http://www.google.cn/search?client=navclient-auto&features=Rank:&q=info:" + txtUrl.Text + "&ch=" + s);

                HttpWReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)";
                HttpWReq.Accept = @"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, */*";


                HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();
                Stream dataStream = HttpWResp.GetResponseStream();
                StreamReader reader = new StreamReader(dataStream, System.Text.Encoding.GetEncoding("GB2312"));
                responseFromServer = reader.ReadToEnd();
            }
            catch
            {
            }


            string[] sp = responseFromServer.Split(':');
            if (sp.Length == 3)
                lbValue.Text = "查询成功! PR = " + sp[2].ToString();
            else
                lbValue.Text = "查询失败!";
            



            
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("http://www.vscodes.com");

        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -