码迷,mamicode.com
首页 > Web开发 > 详细

getPageHtmlViaURL 通过URL取网页HTML

时间:2016-07-03 21:22:28      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:

post

request:

技术分享
{
    "action": "getPageHtmlViaURL",
    "isDebug":1,
    "token": "2aecface-7dbb-44b9-af7b-ba0fb0f3301e",
    "requestData": {
        "URL": "http://baidu.com/"
    }
}
View Code

response:

技术分享
{
    "data": "<!DOCTYPE html><html><head><meta http-equiv=\"content-type\"content=\"text/html;charset=utf-8\"><meta http-equiv=\"X-UA-Compatible\"content=\"IE=Edge\"><meta content=\"never\"name=\"referrer\"><title>百度一下,你就知道</title><style>html,body{height:100%}html{overflow-y:auto}body{font:12px arial;text-align:;background:#fff}body,p,form,ul,li{margin:0;padding:0;list-style:none}body,form{position:relative}td{text-align:left}img{border:0}a{color:#00c}a:active{color:#f60}input{border:0;padding:0}#wrapper{position:relative;_position:;min-height:100%}#head{padding-bottom:100px;text-align:center;*z-index:1}#ftCon{height:100px;position:absolute;bottom:44px;text-align:center;width:100%;margin:0 auto;z-index:0;overflow:hidden}#ftConw{width:720px;margin:0 auto}#lh{margin:16px 0 5px;word-spacing:3px}#lh a{margin:0 10px}#cp,#cp a{color:#666}#wrapper{min-width:810px;height:100%;min-height:600px}#head{position:relative;padding-bottom:0;height:100%;min-height:600px}#head .head_wrapper{height:100%}#form{margin:22px auto 0;width:641px;text-align:left;z-index:100}#form .bdsug{top:35px}#kw{position:relative}.s_btn{width:95px;height:32px;padding-top:2px\\9;font-size:14px;background-color:#ddd;background-position:0 -48px;cursor:pointer}.s_btn{width:100px;height:36px;color:white;font-size:15px;letter-spacing:1px;background:#3385ff;border-bottom:1px solid #2d78f4;outline:medium;*border-bottom:0;-webkit-appearance:none;-webkit-border-radius:0}.s_btn.btnhover{background:#317ef3;border-bottom:1px solid #2868c8;*border-bottom:0;box-shadow:1px 1px 1px #ccc}.s_btn_wr{width:97px;height:34px;display:inline-block;background-position:-120px -48px;*position:relative;z-index:0;vertical-align:top}.s_btn_wr{width:auto;height:auto;border-bottom:1px solid transparent;*border-bottom:0}.s_ipt_wr{height:34px}.s_ipt_wr.bg,.s_btn_wr.bg,#su.bg{background-image:none}.s_ipt_wr{border:1px solid #b6b6b6;border-color:#7b7b7b #b6b6b6 #b6b6b6 #7b7b7b;background:#fff;display:inline-block;vertical-align:top;width:539px;margin-right:0;border-right-width:0;border-color:#b8b8b8 transparent #ccc #b8b8b8;overflow:hidden}.s_ipt{width:526px;height:22px;font:16px/18px arial;line-height:22px\\9;margin:6px 0 0 7px;padding:0;background:transparent;border:0;outline:0;-webkit-appearance:none}.bdsug{position:absolute;width:418px;background:#fff;display:none;border:1px solid #817f82}.bdsug li{width:511px;color:#000;font:14px arial;line-height:25px;padding:0 8px;position:relative;cursor:default}.bdsug{top:35px;width:538px;border-color:#ccc;box-shadow:1px 1px 3px #ededed;_overflow:hidden;-webkit-box-shadow:1px 1px 3px #ededed;-moz-box-shadow:1px 1px 3px #ededed;-o-box-shadow:1px 1px 3px #ededed}.s_form{position:relative;top:38.2%}.s_form_wrapper{position:relative;top:-191px}#u1{z-index:2;color:white;position:absolute;right:0;top:0;margin:19px 0 5px 0;padding:0 96px 0 0}#u1 a:link,#u1 a:visited{color:#666;text-decoration:none}#u1 a:hover,#u1 a:active{text-decoration:underline}#u1 a:active{color:#00c}#u1 a.bri,#u1 a.bri:visited{display:inline-block;position:absolute;right:10px;width:60px;height:23px;float:left;color:white;background:#38f;line-height:24px;font-size:13px;text-align:center;overflow:hidden;border-bottom:1px solid #38f;margin-left:19px;margin-right:2px}#u1 a.mnav,#u1 a.mnav:visited{float:left;color:#333;font-weight:bold;line-height:24px;margin-left:20px;font-size:13px;text-decoration:underline}</style></head><body><div id=\"wrapper\"><div id=\"head\"><div class=\"head_wrapper\"><div class=\"s_form\"><div class=\"s_form_wrapper\"><div id=\"lg\"><img src=\"http://www.baidu.com/img/bd_logo1.png\" width=\"270\" height=\"129\"></div><form id=\"form\" name=\"f\" action=\"https://www.baidu.com/s\" class=\"fm\" method=\"get\"><span class=\"bg s_ipt_wr\"><span id=\"ipt_photo\"></span><input id=\"kw\" name=\"wd\" class=\"s_ipt\" value=\"\" maxlength=\"255\" autocomplete=\"off\"><input type=\"hidden\" name=\"ie\" value=\"utf-8\"><input type=\"hidden\" name=\"tn\" value=\"78040160_19_pg\"><input type=\"hidden\" name=\"ch\" value=\"1\"></span><span class=\"bg s_btn_wr\"><input type=\"submit\" id=\"su\" value=\"百度一下\" class=\"bg s_btn\"></span></form></div></div><div id=\"u1\"><a href=\"http://www.nuomi.com\" class=\"mnav\">糯米</a><a href=\"http://news.baidu.com\" class=\"mnav\">新闻</a><a href=\"http://www.hao123.com\" class=\"mnav\">hao123</a><a href=\"http://map.baidu.com\" class=\"mnav\">地图</a><a href=\"http://v.baidu.com\" class=\"mnav\">视频</a><a href=\"http://tieba.baidu.com\" class=\"mnav\">贴吧</a><a href=\"https://passport.baidu.com/v2/?login&tpl=mn&u=https%3A%2F%2Fwww.baidu.com%2F\" class=\"mnav\">登录</a><a href=\"http://www.baidu.com/gaoji/preferences.html\" class=\"mnav\">设置</a><a href=\"http://www.baidu.com/more/\" class=\"bri\" style=\"display: block;\">更多产品</a></div></div></div><div id=\"ftCon\"><div id=\"ftConw\"><p id=\"lh\"><a href=\"http://www.baidu.com/cache/sethelp/help.html\" target=\"_blank\">把百度设为主页</a><a href=\"http://home.baidu.com\">关于百度</a><a href=\"http://ir.baidu.com\">About Baidu</a></p><p id=\"cp\">©2015 Baidu <a href=\"http://www.baidu.com/duty/\">使用百度前必读</a> <a href=\"http://jianyi.baidu.com/\" class=\"cp-feedback\">意见反馈</a> 京ICP证030173号 <img src=\"http://www.baidu.com/img/gs.gif\"></p></div></div><div id=\"wrapper_wrapper\"></div></div><script type=\"text/javascript\">function qs(n,m,v,u){u=u||D.URL;var t=u.match(eval(‘/(\\\\?|#|&)(‘+n+‘)=([^&]*)(&|$)/i‘));if(t){m=m||t[2];v=t[3]||v}return m&&v?‘&‘+m+‘=‘+v:‘‘}var D=document,d=D,S=!D.cookie.match(/home=s/i);D.oncontextmenu=function(){return false};fc();D.cookie=‘home=s‘;if(D.URL.match(‘#‘))location.replace(‘https://www.baidu.com/s?ch=1‘+qs(‘ie‘)+qs(‘wd|word‘)+‘&tn=78040160_19_pg‘);function fc(){var h=location.host,x=‘=;expires=‘+new Date(0).toUTCString(),y=x+‘;path=‘,z=y+‘/;domain=‘,l=[x,y,y+‘/‘,z+h,z+h.substr(h.indexOf(‘.‘))],o=D.cookie.match(/[^ =;]+(?=\\=)/g);if(o&&S)for(var i=o.length;i--;)for(var j=5;j--;)D.cookie=o[i]+l[j];if(window.localStorage)localStorage.clear();setTimeout(fc,500)}</script></body></html>",
    "msg": "success",
    "responseCode": {
        "msgCode": 200,
        "msgDetail": "OK"
    },
    "serverTime": "2016-07-03 20:51:52",
    "success": true
}
View Code

 

getPageHtmlViaURL 通过URL取网页HTML

标签:

原文地址:http://www.cnblogs.com/jwiter/p/5638795.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!