基本信息
源码名称:C# 自动投票和手机号码归属地查询 功能源码下载
源码大小:0.05M
文件格式:.rar
开发语言:C#
更新时间:2013-09-27
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
C# 自动投票和手机号码归属地查询
C# 自动投票和手机号码归属地查询
using System;
using System.Windows.Forms;
using System.Xml;
namespace HnVote
{
public partial class FormMobile : Form
{
public FormMobile()
{
InitializeComponent();
var formVote = new FormVote();
formVote.Show();
}
private static string[] GetMobileInfo(string number)
{
try
{
var xmlDocument = new XmlDocument();
xmlDocument.Load("http://api.showji.com/Locating/default.aspx?m=" number);
var cx = new XmlNamespaceManager(xmlDocument.NameTable);
cx.AddNamespace("content", "http://api.showji.com/Locating/");
XmlNodeList nodes = xmlDocument.SelectNodes("//content:QueryResult|//content:Mobile|//content:Province|//content:City|//content:Corp|//content:Card|//content:AreaCode|//content:PostCode",cx);
if (nodes != null)
if (nodes.Count == 8)
{
if ("True".Equals(nodes[1].InnerText))
{
return new[]
{
nodes[0].InnerText, nodes[2].InnerText, nodes[3].InnerText,
nodes[4].InnerText,
nodes[5].InnerText, nodes[6].InnerText nodes[7].InnerText
};
}
}
return new[] {"false"};
}
catch (Exception)
{
return new[] {"false"};
}
}
private void button1_Click(object sender, EventArgs e)
{
try
{
string[] num = GetMobileInfo(textBox1.Text);
MessageBox.Show("所查号码:" num[0] "\n归属省份:" num[1] "\n归属城市:" num[2] "\n城市区号:" num[3] "\n城市邮编:" num[4] "\n卡 类 型:" num[5], "查询结果", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
button1_Click(sender, e);
}
}
}
}