12
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.IO;
using System.Net;
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.CenterToScreen();
}
private void button1_Click(object sender, EventArgs e)
{
string http;
if (textBox1.Text.Substring(0, 7) != "http://")
{
http = "http://" + textBox1.Text;
}
else
{
http = textBox1.Text;
}
WebClient heku = new WebClient();
Stream k = heku.OpenRead(http);
StreamReader j = new StreamReader(k,Encoding.GetEncoding("gb2312"));
string ok;
ok = "";
string y;
while ((y=j.ReadLine()) != null)
{
ok=ok+y;
}
textBox2.Text = ok;
string u;
u = "百度一下,你就知道";
MessageBox.Show(ok.Substring(ok.IndexOf(u),u.Length), "提示");
j.Close();
}
}
}
最新文章