Home > Article > Backend Development > How to make 360 search engine include php rewriting method
This time I will bring you how to let 360 search engine include the php rewriting method, and let 360 search engine include the php rewriting method. What are the precautions? The following is a practical case, let's take a look.
360 search engine automatically includes the function. The official code is provided in a tape format, which is very cheating. It does not provide a batch submission entrance, but only provides a piece of js code. The key is to use one js to download another js, document.write Go to the document and repeat the process 2 more times. Weak question: Why not provide a batch submission entrance like Baidu? Could it be that this automatic submission function is used to collect website data, such as document.refer and other data? Isn't this one more rogue? It is said that 360’s search engine currently has a market share of more than 20% in China. I don’t know whether it is true or not, but I am very skeptical! At least I basically only use Google! However, in China, Baidu is still basically used, and there are still too many newbies! I have no choice but to endure it and add 360’s automatic inclusion! So we made some changes to the code! The original code of the official website is as follows:<script>(function(){ var src = (document.location.protocol == "http:") ? "http://js.passport.qihucdn.com/11.0.1.js?970506d365e969bd0e92a2611c18678e":"https://jspassport.ssl.qhimg.com/11.0.1.js?970506d365e969bd0e92a2611c18678e"; document.write('<script src="' + src + '" id="sozz"><\/script>'); })(); http://js.passport.qihucdn.com/11.0.1.js?970506d365e969bd0e92a2611c18678e document.write('<script charset="utf-8" src="http://s7.qhres.com/static/ab77b6ea7f3fbf79.js"></script>')The code provided by the official website has entered the quadratic document.write code as follows. The code of this js is as follows:
/** * 360推送 @www.zhoulujun.cn */ function getPushSoUrl($url){ $token="970506d365e969bd0e92a2611c18678e"; return $str="http://s.360.cn/so/zz.gif?url=".urlencode($url)."&sid=". $token."&token=".getPushToken($url,$token); } function getPushToken($url,$o){ $n = str_split($url,1); $n=array_reverse($n); $r = str_split($o,1); $i=[]; for($s=0,$o=16;$s<$o;$s++) { array_push($i,empty($n[$s])?$r[$s]:$r[$s].$n[$s]); } return implode($i); } /* class push_so_url{ private $token="970506d365e969bd0e92a2611c18678e"; public function setToken($token){ $this->token=$token; } // function construct($token) { // $this->token=$token; // } public function getPushToken($url,$o){ $n = str_split($url,1); $n=array_reverse($n); $r = str_split($o,1); $i=[]; for($s=0,$o=16;$s<$o;$s++) { array_push($i,empty($n[$s])?$r[$s]:$r[$s].$n[$s]); } return implode($i); } public function getImgUrl($url){ return $str="http://s.360.cn/so/zz.gif?url=".urlencode($url)."&sid=". $this->token."&token=".$this->getPushToken($url,$this->token); } } */In the template phpcms/templates/default/content/ For example, add the following code to show index:
<img src="{getPushSoUrl($_SERVER['HTTP_HOST'].$url)}">okay, verify that the effect of and js is the same. I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website! Recommended reading:
Detailed explanation of the steps for PHP to use file_get_contents to send http requests
PHP implements random elimination algorithm
The above is the detailed content of How to make 360 search engine include php rewriting method. For more information, please follow other related articles on the PHP Chinese website!