{"id":859,"date":"2021-03-06T10:36:13","date_gmt":"2021-03-06T02:36:13","guid":{"rendered":"http:\/\/www.tra56.com\/?p=859"},"modified":"2021-03-06T10:36:13","modified_gmt":"2021-03-06T02:36:13","slug":"859","status":"publish","type":"post","link":"https:\/\/www.tra56.com\/859.html","title":{"rendered":"\u767e\u5ea6\u6536\u5f55\u91cfAPI\u67e5\u8be2"},"content":{"rendered":"
<?php\r\n\/*\r\nPlugin Name:\u767e\u5ea6\u6536\u5f55\u91cf\r\nVersion:1.0\r\nDescription:\u6839\u636e\u57df\u540d\u8fd4\u56de\u767e\u5ea6\u6536\u5f55\u91cf\r\n*\/\r\n$domain = (isset($_GET['domain']))?$_GET['domain']:$_POST['domain'];\r\nif(empty($domain)) echo '\u67e5\u8be2\u57df\u540d\u4e0d\u80fd\u4e3a\u7a7a';\r\n\r\n$count = baiduSL ($domain);\r\n\r\nif(!isset($count)) showjson(array('code'=>200502,'msg'=>'\u67e5\u8be2\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\uff01'));\r\nif(!$count) $count = 0;\r\n$result=array(\r\n 'code'=>1,\r\n 'domain'=>$domain,\r\n 'data'=>$count\r\n);\r\nprint_r(json_encode($result));\r\n\r\nunset($value,$url_arr,$domain,$row,$hostrow,$site,$resulturl,$result,$ch);\r\nfunction baiduSL ($domain) {\r\n $baidu='https:\/\/www.baidu.com\/s?ie=utf-8&tn=baidu&wd=site%3A'.$domain; \r\n $bdsite=BD_curl($baidu); \r\n\r\n $bdsite = str_replace(array("\\r\\n", "\\r", "\\n", ' '), '', $bdsite); \r\n preg_match('\/\u8be5\u7f51\u7ad9\u5171\u6709(.*?)\u4e2a\u7f51\u9875\u88ab\u767e\u5ea6\u6536\u5f55\/i',$bdsite,$count);\r\n if (!$count) preg_match('\/\u627e\u5230\u76f8\u5173\u7ed3\u679c\u6570\u7ea6(.*?)\u4e2a\/i',$bdsite,$count);\r\n \/\/ereg('\u8be5\u7f51\u7ad9\u5171\u6709(.*)\u4e2a\u7f51\u9875\u88ab\u767e\u5ea6\u6536\u5f55', $bdsite,$count); \r\n \/\/print_r($count);\r\n \/\/$count=str_replace('\u8be5\u7f51\u7ad9\u5171\u6709','',$count); \r\n \/\/$count=str_replace('\u4e2a\u7f51\u9875\u88ab\u767e\u5ea6\u6536\u5f55','',$count); \r\n $count = str_replace(array("\\r\\n", "\\r", "\\n", ',', ' '), '', $count); \r\n $baiduSL=strip_tags($count[1]); \r\n unset($count);\r\n return $baiduSL;\r\n}\r\nfunction BD_curl($url, $post=0, $referer=0, $cookie=0, $header=0, $ua=0, $nobaody=0){\r\n $ch = curl_init();\r\n $ip = rand(0,255).'.'.rand(0,255).'.'.rand(0,255).'.'.rand(0,255) ;\r\n curl_setopt($ch, CURLOPT_URL, $url);\r\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\r\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);\r\n \/\/$httpheader[] = "Host: www.baidu.com";\r\n \/\/$httpheader[] = "Connection: keep-alive";\r\n \/\/$httpheader[] = "Upgrade-Insecure-Requests: 1";\r\n \/\/$httpheader[] = "User-Agent: Mozilla\/5.0 (Windows NT 6.1; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/55.0.2883.87 Safari\/537.36";\r\n $httpheader[] = "Accept: text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,*\/*;q=0.8";\r\n $httpheader[] = "Accept-Encoding: gzip, deflate, sdch, br";\r\n $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";\r\n \/\/$httpheader[] = 'X-FORWARDED-FOR:'.$ip;\r\n \/\/$httpheader[] = 'CLIENT-IP:'.$ip;\r\n curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);\r\n if ($post) {\r\n curl_setopt($ch, CURLOPT_POST, 1);\r\n curl_setopt($ch, CURLOPT_POSTFIELDS, $post);\r\n }\r\n if ($header) {\r\n curl_setopt($ch, CURLOPT_HEADER, true);\r\n }\r\n if ($cookie) {\r\n curl_setopt($ch, CURLOPT_COOKIE, $cookie);\r\n }\r\n if($referer){\r\n if($referer==1){\r\n curl_setopt($ch, CURLOPT_REFERER, 'https:\/\/music.163.com\/outchain\/player?type=0&id=2250011882&auto=1');\r\n }else{\r\n curl_setopt($ch, CURLOPT_REFERER, $referer);\r\n }\r\n }\r\n if ($ua) {\r\n curl_setopt($ch, CURLOPT_USERAGENT, $ua);\r\n }\r\n else {\r\n curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla\/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit\/601.1.46 (KHTML, like Gecko) Version\/9.0 Mobile\/13B143 Safari\/601.1");\r\n }\r\n if ($nobaody) {\r\n curl_setopt($ch, CURLOPT_NOBODY, 1);\r\n }\r\n curl_setopt($ch, CURLOPT_TIMEOUT, 3);\r\n curl_setopt($ch, CURLOPT_ENCODING, "gzip");\r\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n $ret = curl_exec($ch);\r\n \/\/$Headers = curl_getinfo($ch);\r\n curl_close($ch);\r\n return $ret;\r\n}\r\nfunction showjson($arr){\r\n header("Content-Type: application\/json; charset=utf-8");\r\n exit(json_encode($arr,320));\r\n}\r\n?><\/pre>\n<\/p>\n","protected":false},"excerpt":{"rendered":"
<?php \/* Plugin Name:\u767e\u5ea6\u6536\u5f55\u91cf Version:1.0 Descript […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[26,72],"class_list":["post-859","post","type-post","status-publish","format-standard","hentry","category-php","tag-php"],"_links":{"self":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/859"}],"collection":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/comments?post=859"}],"version-history":[{"count":1,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/859\/revisions"}],"predecessor-version":[{"id":860,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/859\/revisions\/860"}],"wp:attachment":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/media?parent=859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/categories?post=859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/tags?post=859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}