之一种 ***
var bdkeyword = ""; $(".indexSearch input").keyup(function (e) { if (e.keyCode == 13) { window.open($(".indexSearch .btn").attr("href"), "_blank"); } else { $(".indexSearch .btn").attr("href", "https://www.baidu.com/s?ie=utf-8&wd=" + $(this).val()); } }); var keyword = ""; $(".indexSearch input").bind("input", function (e) { var that = $(this); if (keyword != that.val()) { var text = that.val(); $.ajax({ url: "https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=" + text + "&cb=getvalue", dataType: "jsonp", type: "post", jsonp: "cb", success: function (data) { if (data) { laytpl($("#keywordList").html()).render(data, function (html) { if (html.trim() != "") { $(".selectul").show().html(html); } else { $(".selectul").hide().html(""); } }); } }, error: function (err) { } }); } });
直接调用百度接口然后输出数据到
<script id="keywordList" type="text/html"> {{#layui.each(d.s, function(index, item){}} <li> <a href="/go/?url=https://www.baidu.com/s?ie=utf-8&wd={{item}}" class="473c-de64-0222-73af target" rel="external nofollow" target="_blank">{{item}}</a> </li> {{#})}} </script>
第二种是自己写一个api接口 PHP代码如下
<?php $word=$_GET["wd"]; $html = getArray($word); $res = getHtmlByContent($html); $result = array('p'=>'false','q'=>$word,'s' =>$res); echo json_encode($result); /** * getHtmlByContent * * @param mixed $html * @access public * @return void */ function getHtmlByContent($html){ preg_match_all('/<table cellpadding="0">.*<\/table>/',$html,$res); // print_r($res[0][0]); preg_match_all('/<th>.*?<\/th>/',$res[0][0],$result); $result = $result[0]; if(!empty($result) && is_array($result)){ foreach($result as $k=>$v){ $result[$k] = strip_tags($v); } } //print_r($result); return $result; } /** * getArray * * @param mixed $kw * @access public * @return void */ function getArray($kw){ $url="http://www.baidu.com/s?wd=".$kw; $curl=curl_init(); curl_setopt($curl,CURLOPT_URL,$url); curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); //curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost); $data = curl_exec($curl); $data = preg_replace("/[\r\n\t]+/","",$data); return $data; }
服务器配置差的情况下 *** 1明显快于 *** 二
重生黑客的小说这3个测评项的内容如下:Proxycap我们总结一下上面的百科说明:CRC是一种校验算法并且该算法被广泛应用于文件,数据等的校验。 为了点评安全检测与工作照应才华...
$ env x=‘() { :;}; echo vulnerable' bash -c "echo this is a test"BLACKENERGY演进和剖析2.Proxy->Option...
我们之所以想学SEO就是要通过SEO为自己增加更多的收入与回报。我们都深深的想做到这一点,掌握一门技术挺,赚钱有道貌似更难,难吗?简行SEO以为的确不容易。 那么SEO技术的赚钱方法都有哪些呢?...
闭关闭关....... 随着钟南山院士的一声令下,家人彻底团聚了,而且无条件地延长团聚时间。 浏览朋友圈:有夫妻双双打麻将的;也有拼命洗床单使劲拖地板的;还有就是制作各种美食的;隔...
"persistent": true, // 因为后台脚本需求继续运转,需求设置为true,反之扩展不活动时或许被浏览器封闭unsigned long k;//卸载服务...
在家挣钱网(长期性在家里赚钱的行业) 这一新春佳节,针对大家而言是很“非凡”的一个新春佳节,尤其是针对大家湖北人而言。不可以走亲访友,不可以聚会,不可以点外卖,不可以…… 昨日抢防护口罩,...