Webluker cache refresh-php version
function 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]";
A
Rray_push ($ a, $ B );
}
$ S = join ("&", $ );
$ S1 = $ s. $ key;
$ S2 = fixEncoding ($ s1 );
$ Sign = md5 ($ s2 );
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 /';
If ($ _ SERVER ['request _ method'] = 'post '){
$ Get_url = trim ($ _ POST ['URL']);
$ A = str_replace ("\ n", $ 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 );
}
?>