【文件属性】:
文件名称:c#抓取页面小工具
文件大小:43KB
文件格式:ZIP
更新时间:2016-09-04 08:44:14
c#+js js采集 http
有没有试过 用js 采集网页呢?
用c#提供方法给js, js便可实现采集数据的功能
先 show 下 js代码:
function get_contents(){
try{
var url=$("#url").val();
// '{"a":"11","b":"22"}' 这个是传递过去的参数,回来的时候的 标识
window.external.get_contents("_get_contents_back",url,'','{"a":"11","b":"22"}');
}catch(e){
alert(e.message);
}
}
function _get_contents_back(funcname,content,frame,jsonstr){
try{
$("#content").val(content);
var json=eval("("+jsonstr+")");
alert('js传过去的参数:'+jsonstr);
//alert(json.a);
//alert(attr);
}catch(e){alert(e.message);}
}
【文件预览】:
WindowsApplication1.sln
WindowsApplication1.suo
WindowsApplication1
----Form1.cs(10KB)
----Program.cs(478B)
----Form1.resx(6KB)
----Properties()
--------Settings.settings(249B)
--------Resources.Designer.cs(3KB)
--------AssemblyInfo.cs(1KB)
--------Settings.Designer.cs(1KB)
--------Resources.resx(5KB)
----Form1.Designer.cs(1010B)
----WindowsApplication1.csproj(3KB)
----obj()
--------Debug()
--------WindowsApplication1.csproj.FileListAbsolute.txt(1KB)
----bin()
--------Debug()