Tag:webluker php Refresh cache
<?phpfunction fixencoding ($in _str) { $cur _encoding = mb_detect_ Encoding ($in _str) ; if ($cur _encoding == "UTF-8" && mb_ Check_encoding ($in _str, "UTF-8")) return $in _str; else return utf8_encode ($in _str);} Function getsign ($data, $key) { $dataList = array_keys ($data); sort ($dataList); $a = array (); foreach ($dataList as $value) { $b = "$value = $data [$value]"; array_push ($a, $b); } $s = join ("&", $a); $s 1 = $s $key; $s 2 = fixencoding ($s 1); $sign = md5 ($s 2); return $sign;} Function dopost ($url, $postData) {$ch = curl_init ();curl_setopt ( $ch, curlopt_url, $url );curl_setopt ( $ch, curlopt_customrequest, "POST") curl_setopt ( $ch, curlopt_header, 0 );curl_setopt ( $ch, curlopt_returntransfer, 1 );curl_setopt ( $ch, curlopt_postfields, $postData) $arr =curl_exec ($ch) curl_ Close ($ch);return $arr;} $username =****** $key =*********************** $cache _url = ' http://agent.webluker.com/api/cacherefresh/'; ($_server[' request_method ']== ' POST ') { $get _url=trim ($_post[' url '); $a = str_replace ("\ n", "&NBSP;,", $get _url); $c = array ( "username" => "$username", "Refresh_url" => "[' $a ']", "Refresh_type" => "0", ; $sign =getsign ($c, $key); $reurl = $c [' refresh_url ']; $postData = "username = $username &refresh_type=0&refresh_url= ". $reurl." &sign= ". $sign; $result =dopost ($cache _url, $postData);}? >
This article is from the "Tranquility Zhiyuan" blog, please be sure to keep this source http://irow10.blog.51cto.com/2425361/1787211
Webluker Refreshing cache version-php