借助IP138网站来实现本地系统的IP,身份证号,手机号码查询功能
来源:互联网 发布:电池修复软件 编辑:程序博客网 时间:2024/04/30 09:09
公司内部的CRM系统和呼叫中心系统,客服人员经常会用到电话归属地查询,原来一直用Iframe嵌套IP138的查询页面,但总感觉有些不爽,公司还不愿意花钱去买手机号段库,因此决定通过程序将其解决;
通过此方式,公司内部呼叫中心系统即可实现,来电号码所属地区的提示,外呼时,系统也可判定手机号码前是否应该加0,比较多的问题都可解决,页面代码刻录如下:
C#语言: crm
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
GetMobilePhoneInfo();
}
private void GetMobilePhoneInfo()
{
WebClient wb = new WebClient();
NameValueCollection myNameValueCollection = new NameValueCollection();
myNameValueCollection.Add("mobile", "13651259785");
myNameValueCollection.Add("action", "mobile");
byte[] pagedata = wb.UploadValues(new Uri("http://www.ip138.com:8080/search.asp"), myNameValueCollection);
string result = Encoding.Default.GetString(pagedata);
string pat = "tdc2>([^<]*)</TD>";
Regex r = new Regex(pat, RegexOptions.IgnoreCase);
Match m = r.Match(result);
string[] strInfo = new string[4] { "", "", "", "" };
int i = 0;
while (m.Success)
{
if (i < strInfo.Length)
{
int end = m.ToString().IndexOf("<");
strInfo[i] = m.ToString().Substring(5,end-5);
}
m = m.NextMatch();
i++;
}
string mobilephone = strInfo[0].ToString();
string provinceCity = strInfo[1].ToString();
string type = strInfo[2].ToString();
string areaCode = strInfo[3].ToString();
Response.Write(mobilephone + "<br>");
Response.Write(provinceCity + "<br>");
Response.Write(type + "<br>");
Response.Write(areaCode + "<br>");
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
GetMobilePhoneInfo();
}
private void GetMobilePhoneInfo()
{
WebClient wb = new WebClient();
NameValueCollection myNameValueCollection = new NameValueCollection();
myNameValueCollection.Add("mobile", "13651259785");
myNameValueCollection.Add("action", "mobile");
byte[] pagedata = wb.UploadValues(new Uri("http://www.ip138.com:8080/search.asp"), myNameValueCollection);
string result = Encoding.Default.GetString(pagedata);
string pat = "tdc2>([^<]*)</TD>";
Regex r = new Regex(pat, RegexOptions.IgnoreCase);
Match m = r.Match(result);
string[] strInfo = new string[4] { "", "", "", "" };
int i = 0;
while (m.Success)
{
if (i < strInfo.Length)
{
int end = m.ToString().IndexOf("<");
strInfo[i] = m.ToString().Substring(5,end-5);
}
m = m.NextMatch();
i++;
}
string mobilephone = strInfo[0].ToString();
string provinceCity = strInfo[1].ToString();
string type = strInfo[2].ToString();
string areaCode = strInfo[3].ToString();
Response.Write(mobilephone + "<br>");
Response.Write(provinceCity + "<br>");
Response.Write(type + "<br>");
Response.Write(areaCode + "<br>");
}
}
- 借助IP138网站来实现本地系统的IP,身份证号,手机号码查询功能
- java调用ip138实现ip地址查询
- 借助谷歌帮你的网站实现搜索功能
- IP138 IP地址查询 php实例
- 从IP138上获取数据,查询多个IP的归宿地
- 给大家推荐一个查询手机号码归属地和IP物理地址及whois的网站
- 给大家推荐一个查询手机号码归属地和IP物理地址及whois的网站
- 获取本机公网上的IP地址(借助发布在公网上的IP查询网站)
- ASP.NET通过IP138来获取外面IP地址
- [Python] 从ip138网站爬取ip所处地点
- 借助javaMail来实现邮件的收发功能之知识篇
- 网站建设:如何实现asp网站的本地测试功能
- C#读取纯真IP数据库的代码&手机号码归属地查询代码C#实现
- java WebService实现手机号码归属地查询功能
- webservice-实现手机号码归属地的查询
- 查询本地ip的网址
- 本地的手机号码归属地查询-oracle数据
- [AHK]爬虫基础 解析IP138网站返回的结果
- 如何将.spl剥离成.emf文件格式
- 使用ADS+HJTAG调试Boot Loader
- FCK FredCK.FCKeditorV2 FredCK.FCKeditorV2.6.6 源码分享
- 输入汉字,得到汉字的大写首字母
- postgresq+postgis导入导出shape文件的编码问题
- 借助IP138网站来实现本地系统的IP,身份证号,手机号码查询功能
- 42种编程语言写hello world
- Web出错,跳到相应的页面可以设置Web.Config文件
- Struts 2 之Action类详解
- 母亲节快到!我打算买个蛋糕,谢谢妈妈,祝妈妈健康、长寿、快乐!!!!!!!!!!!
- 【转载】java和J2EE的区别
- 如何快速获取CSDN可用分
- 1170: Wire Is So Expensive
- 文件 数据结构示意