#import "wed.h"============================================
@implementation wed
+(NSString *) urlstring:(NSString *)strurl{
NSURL *url = [NSURL URLWithString :strurl];
NSData *data = [NSData dataWithContentsOfURL :url];
NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding( kCFStringEncodingGB_18030_2000);
NSString *retStr = [[NSString alloc ] initWithData :data encoding :enc];
//NSLog(@" html = %@",retStr);
return retStr;
}
@end
==================================================================================================m文件
- (void )viewDidLoad
{ NSLog ( @"nihao");
NSString *strurl= @"http://zhidao.baidu.com";
NSString *wedimfomation =[wed urlstring :strurl];
NSLog (@"%@" ,wedimfomation);
[ super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
==================================结果===============
2014-07-11 10:57:32.571 爬虫 test[861:90b] nihao
2014-07-11 10:57:44.505 爬虫 test[861:90b]
百度知道 - 全球最大中文互动问答平台
//
void function(e,t,n,a,o,i,m){e.alogObjectName=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=e[o].l||+new Date,i=t.createElement(n),i.asyn=1,i.src=a,m=t.getElementsByTagName(n)[0],m.parentNode.insertBefore(i,m)}(window,document,"script","http://img.baidu.com/hunter/alog.min.js","alog");
//
void function(e,o){var t,n="Other";(t=/\b(safari|firefox|chrome|opera)\b.*?(\d+)/i.exec(o))&&(n=t[1]),(t=/MSIE ([0-9]*)/.exec(o))&&(n="IE"+t[1]),!/^IE/.test(n)&&(t=/trident\/.* rv:([\w]+)?/i.exec(o))&&(n="IE"+t[1]),/(M?QQBrowser)\/([0-9.]*)/.test(o)&&(n="QQ Browser"),/SE 2.X MetaSr/.test(o)&&(n="Sogou Explorer"),alog("exception.set","browser",n);var r=!1;e.οnerrοr=function(e,o,t,n){var c=!0;return!o&&/^script error/i.test(e)&&(r?c=!1:r=!0),c&&alog("exception.send","exception",{msg:e,js:o,ln:t,col:n}),!1},alog("exception.on","catch",function(e){alog("exception.send","exception",{msg:e.msg,js:e.path,ln:e.ln,method:e.method,flag:"catch"})}),alog("exception.on","count",function(e){alog("exception.send","exception",{msg:e.toString(),flag:"count"})})}(window,navigator.userAgent);
" />
!function(){var n={},t={};n.context=function(n,e){var i=arguments.length;if(i>1)t[n]=e;else if(1==i){if("object"!=typeof n)return t[n];for(var o in n)n.hasOwnProperty(o)&&(t[o]=n[o])}},"F"in window||(window.F=n)}();;
F.context('user', {"isLogin":"","stoken":"","name":"","id":"","wealth":"","gradeIndex":""});
F.context('defaultQuery', '{"title":"","value":""}');
F.context('category', {
74: [
{"name": "电脑装机 \/ 选购 ", "id": 1063}
, {"name": "编程语言 ", "id": 1073}
, {"name": "软件开发 ", "id": 1237}
, {"name": "百度产品 ", "id": 1075}
, {"name": "笔记本电脑 ", "id": 872}
, {"name": "平板电脑 ", "id": 1238}
, {"name": "操作系统 \/ 系统故障 ", "id": 89}
], 80: [
{"name": "美食 \/ 烹饪 ", "id": 148}
, {"name": "购房置业 ", "id": 153}
, {"name": "家居装修 ", "id": 154}
, {"name": "家电 ", "id": 874}
, {"name": "保健养生 ", "id": 928}
, {"name": "购车养车 ", "id": 155}
, {"name": "交通出行 ", "id": 158}
, {"name": "生活常识 ", "id": 163}
, {"name": "婚嫁 ", "id": 876}
, {"name": "起名 \/ 算命 ", "id": 162}
, {"name": "礼节礼仪 ", "id": 166}
, {"name": "育儿 ", "id": 160}
], 79: [
{"name": "外科 ", "id": 791}
, {"name": "肿瘤科 ", "id": 770}
, {"name": "儿科 ", "id": 793}
, {"name": "五官科 ", "id": 795}
, {"name": "男性泌尿科 ", "id": 930}
, {"name": "传染科 ", "id": 796}
, {"name": "中医 ", "id": 140}
, {"name": "精神心理科 ", "id": 143}
, {"name": "皮肤科 ", "id": 794}
, {"name": "医院 ", "id": 1193}
, {"name": "整形科 ", "id": 1291}
, {"name": "性病科 ", "id": 1292}
], 78: [
{"name": "奥运 \/ 赛事 ", "id": 999}
, {"name": "赛车 \/F1", "id": 126}
, {"name": "小球运动 ", "id": 778}
, {"name": "田径 ", "id": 127}
, {"name": "游泳 ", "id": 997}
, {"name": "棋牌麻将 ", "id": 132}
, {"name": "户外运动 ", "id": 779}
, {"name": "运动用品 ", "id": 135}
, {"name": "体育名人 ", "id": 109}
, {"name": "武术搏击 ", "id": 131}
, {"name": "亚运会 ", "id": 1192}
, {"name": "女子运动 ", "id": 1057}
], 95: [
{"name": "MP4\/MP3", "id": 879}
], 82: [
{"name": "外汇 ", "id": 1079}
, {"name": "基金 ", "id": 862}
, {"name": "保险 ", "id": 159}
, {"name": "企业管理 ", "id": 774}
, {"name": "商务文书 ", "id": 185}
, {"name": "银行业务 ", "id": 786}
, {"name": "经济研究 ", "id": 923}
, {"name": "产业信息 ", "id": 924}
, {"name": "贸易 ", "id": 183}
, {"name": "个人理财 ", "id": 164}
], 83: [
{"name": "升学入学 ", "id": 1092}
, {"name": "院校信息 ", "id": 192}
, {"name": "学习帮助 ", "id": 197}
, {"name": "职业教育 ", "id": 1093}
, {"name": "出国 \/ 留学 ", "id": 189}
, {"name": "人文学科 ", "id": 1223}
], 84: [
{"name": "公务办理 ", "id": 1095}
, {"name": "军事 ", "id": 211}
, {"name": "宗教 ", "id": 208}
, {"name": "其他社会话题 ", "id": 204}
], 85: [
{"name": "民俗传统 ", "id": 206}
, {"name": "地理 ", "id": 1096}
, {"name": "器乐 \/ 声乐 ", "id": 214}
, {"name": "舞蹈 ", "id": 212}
], 77: [
{"name": "腾讯游戏 ", "id": 1113}
, {"name": "网易游戏 ", "id": 1116}
, {"name": "盛大游戏 ", "id": 1114}
, {"name": "搜狐畅游 ", "id": 1224}
, {"name": "完美游戏 ", "id": 1115}
, {"name": "巨人游戏 ", "id": 1194}
, {"name": "光宇游戏 ", "id": 1195}
, {"name": "金山游戏 ", "id": 1196}
, {"name": "久游游戏 ", "id": 1117}
, {"name": "绿岸游戏 ", "id": 1225}
, {"name": "百度游戏 ", "id": 1190}
, {"name": "网页游戏 ", "id": 1107}
, {"name": "电视游戏 ", "id": 113}
, {"name": "掌机游戏 ", "id": 1197}
, {"name": "手机游戏 ", "id": 114}
, {"name": "小游戏 ", "id": 118}
, {"name": "桌上游戏 ", "id": 1108}
], 1031: [
{"name": "电视 ", "id": 97}
, {"name": "明星 ", "id": 75}
, {"name": "星座 \/ 运势 ", "id": 101}
, {"name": "度假旅游 ", "id": 965}
, {"name": "摄影摄像 ", "id": 780}
, {"name": "宠物 ", "id": 151}
, {"name": "花鸟鱼虫 ", "id": 169}
, {"name": "收藏 ", "id": 168}
, {"name": "幽默滑稽 ", "id": 103}
, {"name": "脑筋急转弯 ", "id": 104}
, {"name": "谜语 ", "id": 1032}
, {"name": "博彩 ", "id": 105}
], 81: [
{"name": "家庭关系 ", "id": 173}
, {"name": "两性问题 ", "id": 174}
, {"name": "青春期 ", "id": 175}
, {"name": "校园生活 ", "id": 176}
, {"name": "交友技巧 ", "id": 167}
], 1101: [
{"name": "软件共享 ", "id": 763}
, {"name": "文档 \/ 报告共享 ", "id": 196}
, {"name": "数字证书共享 ", "id": 1106}
, {"name": "号码类资源共享 ", "id": 1221}
], 1: [
{"name": "天津 ", "id": 239}
, {"name": "重庆 ", "id": 241}
, {"name": "河北 ", "id": 242}
, {"name": "辽宁 ", "id": 243}
, {"name": "黑龙江 ", "id": 244}
, {"name": "吉林 ", "id": 245}
, {"name": "山西 ", "id": 247}
, {"name": "安徽 ", "id": 248}
, {"name": "浙江 ", "id": 249}
, {"name": "江苏 ", "id": 250}
, {"name": "江西 ", "id": 251}
, {"name": "广东 ", "id": 252}
, {"name": "福建 ", "id": 253}
, {"name": "海南 ", "id": 254}
, {"name": "河南 ", "id": 255}
, {"name": "湖北 ", "id": 256}
, {"name": "湖南 ", "id": 257}
, {"name": "四川 ", "id": 258}
, {"name": "云南 ", "id": 259}
, {"name": "贵州 ", "id": 260}
, {"name": "陕西 ", "id": 261}
, {"name": "甘肃 ", "id": 262}
, {"name": "青海 ", "id": 263}
, {"name": "宁夏 ", "id": 264}
, {"name": "内蒙古 ", "id": 265}
, {"name": "广西 ", "id": 266}
, {"name": "西藏 ", "id": 267}
, {"name": "新疆 ", "id": 268}
, {"name": "香港 ", "id": 269}
, {"name": "澳门 ", "id": 270}
, {"name": "台湾 ", "id": 271}
, {"name": "海外地区 ", "id": 760}
] });
百度知道 ">
新闻
网页
贴吧
知道
音乐
图片
视频
地图
百科
文库
经验
人类需要改良吗?
人们为何喜欢八卦?
普通人的大脑只开发利用了 10% ?
更多
问题分类
手机提问
电脑 / 网络
硬件 常见软件 互联网
生活
服装 / 首饰 美容 / 塑身 购物
医疗健康
内科 妇产科 人体常识
体育 / 运动
足球 篮球 健身
电子数码
手机 / 通讯 照相机 / 摄像机
商业 / 理财
股票 财务税务 创业投资
教育 / 科学
理工学科 外语学习
社会民生
法律 求职就业 时事政治
文化 / 艺术
文学 历史话题 书画美术
游戏
网络游戏 单机游戏
娱乐休闲
音乐 电影 动漫
烦恼
夫妻 恋爱 情感情绪
资源共享
视频共享 音频 / 歌曲共享
地区
北京 上海 山东
大家都在问
呵呵,各位学霸,求解
7 秒前
热心网友、热心网友参与了回答
机智的小伙伴们,求教这道题的详细做法,多谢啦
16 秒前
热心网友、热心网友参与了回答
653+685-66
17 秒前
热心网友、热心网友等 4 人参与了回答
太好了的单词
21 秒前
热心网友、热心网友参与了回答
帮一下忙喽!
25 秒前
热心网友、热心网友参与了回答
QQ 会员好还是超级 QQ 好?
来自手机知道 ">
28 秒前
热心网友、天赋大踏步参与了回答
用河湾组句子
29 秒前
热心网友、热心网友等 3 人参与了回答
好的采纳
30 秒前
热心网友、热心网友参与了回答
( ),种豆得豆 (
37 秒前
热心网友、热心网友等 5 人参与了回答
一道难题,求学霸指点,谢谢
42 秒前
热心网友、热心网友参与了回答
什么意思
50 秒前
热心网友、热心网友等 3 人参与了回答
知道专家排行
徐清芝 医生
专长:儿科
上周回答数: 5943
好评率:
上周回答 5170
李庆峰医生
上周回答 4802
刘辉东医生
上周回答 4550
秦爱洁医生
上周回答 4384
李京保医生
名医义诊
汪波主任:冬季呼吸疾病的防治
前些天突发心慌气短,医院检查是说是房颤 ...
房颤通常跟高血压、冠心病、风湿性心脏病以及甲亢有关系,所以要排除 ...294
推荐名医
北京大学医院熊辉
北京军联骨科医院赵克明
北京东直门医院杨保林
达人风采
景龙盛世:知道之星
求鉴定这只翡翠值多少钱?
从图上来看这是一只天然翡翠 A 货手镯,货真价实,其翡翠料子为糯种 ...1
企业知道
更多
联想企业平台
全球领先 pc 企业,享誉全球的 Think 及 Idea 品牌。
更多
公告区
坚决清理网上淫秽色情信息
帮助手册:如何使用知道
新品上线:作业帮 APP 发布啦
爱知道,解答你的青春期困惑
关注知道日报微博拿好礼!
太阳系外找 “ 地球 ”
地月相吸,为何月球却在远离地球?
月球每年远离地球约 3.8 厘米,而导致月球远离地球的 “ 真凶 ” ,就是地 ...
人类生产的涂料,够粉刷地球吗?
“ 涂料还未备齐,地球人尚需努力 ” ,到 2100 年,可能就够了。
如果地球每秒自转一圈会怎样?
赤道部分将以光速的 10% 的速度运动。离心力将大大超过地球重力,于 ...
帮助
|
意见反馈
|
投诉举报
|
知道协议 " target="_blank"> 知道协议
|
加入我们
©2014 Baidu 使用百度前必读 | 百度知道开放平台
!function(){ require.async('common:widget/userbar/userbar.js');
}();
!function(){ require.async('common:widget/js/logic/search-box/search-box.js');
}();
!function(){require.async('common:widget/menu/menu.js', function(menu){
menu.init();
});
}();
!function(){ require.async('home:widget/recommend/recommend.js');
}();
!function(){ require.async('home:widget/zhidao-info/zhidao-info.js',function(e){
e.init({'finishCount':326336828});
});
}();
!function(){ require.async('home:widget/category/category.js');
}();
!function(){ require.async(['common:widget/js/util/tangram/tangram.js', 'home:widget/js/lazyload/lazyload.js', 'common:widget/js/ui/prof-star/prof-star.js'], function($, lazyload, ProfStar){
ProfStar({
target: $('.expert-star-c'),
rate: parseInt('99.612148696223'),
starW: 17,
starG: 3
});
lazyload.add('#expert-rank', '#expert-rank .expert-img');
//util.fixedAsk.bind('#expert-rank .fixed-ask')
});
}();
!function(){ require.async(['home:widget/js/lazyload/lazyload.js', 'home:widget/js/fixed-ask/fixed-ask.js'], function(lazyload, fixedAsk){
lazyload.add('.famous-user', '.famous-user .inner-left a');
fixedAsk.bind('.famous-user .fixed-ask');
});
}();
!function(){require.async("home:widget/user-rank/user-rank.js");}();
!function(){ require.async(['home:widget/js/lazyload/lazyload.js', 'home:widget/js/fixed-ask/fixed-ask.js'], function(lazyload, fixedAsk){
lazyload.add('.master-user', '.master-user .inner-left a');
fixedAsk.bind('.master-user .fixed-ask');
});
}();
!function(){ require.async('home:widget/enterprise-rank/enterprise-rank.js');
}();
!function(){ require.async('home:widget/enterprise-logo/enterprise-logo.js');
}();
!function(){ require.async(['home:widget/union/union.js', 'home:widget/js/lazyload/lazyload.js'], function(union, lazyload){
lazyload.add('#union-home_bottom', function(){
union.init('615519', 'union-home_bottom');
}, {method: 'callback'});
});
}();
!function(){ require.async('home:widget/promotion/promotion.js',function(e){
e.init([{"imgUrl":"http:\/\/img.iknow.bdimg.com\/qq\/20140709\/ditu212-132.jpg?t=1404977798","url":"http:\/\/map.baidu.com\/zt\/freeday\/cup-PC\/?fr=know","title":""},{"imgUrl":"http:\/\/img.baidu.com\/img\/iknow\/r\/image\/2014-07-04\/443cc7e5089a3c2af8c010539355dce6.jpg?t=1404977798","url":"http:\/\/tieba.baidu.com\/p\/3139231833","title":""},{"imgUrl":"http:\/\/img.iknow.bdimg.com\/lijingjing\/212X132.jpg?t=1404977798","url":"http:\/\/zhidao.baidu.com\/s\/ysld.html","title":""}]);
});
}();
!function(){ require.async('home:widget/hot-topic/hot-topic.js');
}();
!function(){ require.async(['common:widget/js/util/tangram/tangram.js', 'common:widget/js/util/log/log.js'], function(T, log){
T('a[href!="#"]').click(function(e){
log.send({ 'type': 2058, 'pos': 'home_link_pv', 'evtType': 'click', 'href': this.href });
});
T(document).ready(function(){
if ( T('#bottom-ad table').length > 0 ) {
log.send({ 'type':2058, 'params':'home' });
}
});
});
}();
!function(){
require.async('common:widget/js/logic/dom-ready/dom-ready.js', function(D){ D.init({"pathname":"\/"}) });
}();
(function (){
(function(e){e=e||{};var a="http://img.baidu.com/hunter/alog/",t="http://nsclick.baidu.com/u.gif",p="http://static.tieba.baidu.com/tb/pms/img/st.gif";e.page&&(alog("set","alias",{monkey:a+"monkey.min.js",element:a+"element.min.js",speed:"http://static.tieba.baidu.com/tb/pms/wpo_alog_speed.js",feature:a+"feature.min.js"}),alog("require",["monkey","element"],function(a){var p={page:e.page,pid:"241",p:"102",hid:"2680",postUrl:t,pageflag:e.pageflag||"",reports:{refer:1,staytime:1}};if(e.params)for(var i in e.params)p[i]=e.params[i];a.create(p)}),alog("monkey.send","pageview",{now:+new Date}),e.err&&parseFloat(e.err.sample)>=Math.random()&&alog("exception.create",{postUrl:t,page:e.page,pid:"170",p:"102"}),e.feature&&parseFloat(e.feature.sample)>=Math.random()&&alog("require","feature",function(a){a.create({dv:4,postUrl:p,page:e.page,p:"102"}),a.fire("commit")})),e.wpd&&alog("speed.set","options",{is_login:F.context("user").isLogin?1:0,sample:parseFloat(e.wpd.sample),product_id:"102",page_id:e.wpd.pageid})}).apply(window,"undefined"!=typeof arguments&&arguments);;
})({"page":"zhidao-home","pageflag":"0","wpd":{"sample":"0.1","pageid":"4"}});
void function(g,a){function i(m,n,l){l=l||15;var o=new Date();o.setTime(new Date().getTime()+l*1000);a.cookie=m+"="+escape(n)+";path=/;expires="+o.toGMTString()}function h(m){var l=a.cookie.match(new RegExp("(^| )"+m+"=([^;]*)(;|$)"));if(l!=null){return unescape(l[2])}return null}function c(l){if(g.attachEvent){g.attachEvent("onload",l,false)}else{if(g.addEventListener){g.addEventListener("load",l)}}}function e(){var m=alog.tracker&&alog.tracker("speed").get("options")||{};var q=m.random=Math.random();var p=m.special_pages||[];var l=[];for(var n=0;n < p.length;n++){var o=p[n];if(q < o.sample){l.push(o.id)}}if(l.length){alog("speed.set","special_id","["+l+"]")}if(q<=m.sample||l.length){alog("speed.set","send",true);if(m.product_id&&m.page_id){alog("require","speed")}}}function b(){var l=h("PMS_JT");if(l){i("PMS_JT","",-1);try{l=eval(l);}catch(e){l={};}if(!l.r||a.referrer.replace(/#.*/,"")==l.r){alog("speed.set","wt",l.s)}}}b();var f=false;
function d(){alog.on&&alog.on("mark",function(p){var n=alog.tracker&&alog.tracker("speed").get("options")||{};f=true;if(n&&n.custom_metrics&&n.custom_metrics.constructor==Array){var m=n.custom_metrics;var l=alog.tracker("speed").fields;for(var o=0;o < m.length;o++){if(!l||!l.hasOwnProperty(m[o])){f=false;break}}}f&&e()})}c(function(){d();alog("speed.set","lt",+new Date);alog.fire&&alog.fire("mark")});function k(n,m){var l=0;if((m.nodeName||m.tagName).toLowerCase()===n.toLowerCase()){return m}while(m=m.parentNode){l++;if((m.nodeName||m.tagName).toLowerCase()===n.toLowerCase()){return m}if(l>=4){return null}}return null}function j(l){if(a.attachEvent){a.attachEvent("onclick",l)}else{a.addEventListener("click",l,false)}}j(function(n){var n=n||window.event;var m=n.target||n.srcElement;var o=k("a",m);if(o){var l=o.getAttribute("href");if(!/^#|javascript:/.test(l)){i("PMS_JT",'({"s":'+(+new Date)+',"r":"'+document.URL.replace(/#.*/,"")+'"})')}}})}(window,document);
//
with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://img.baidu.com/hunter/zhidao.js?cdnversion='+~(new Date()/864e5)];
require.async('common:widget/lib/jquery/jquery.js', function($){
$(function(){
alog && alog('speed.set', 'drt', new Date);
});
});