$secret = "***********";
$url = "http://www.appsmail.ru/platform/api";
$app_id = "******";
function sign_server_server(array $request_params, $secret_key) {
ksort($request_params);
$params = '';
foreach ($request_params as $key => $value) {
$params .= "$key=$value";
}
return md5($params . $secret_key);
}
function parseQueryString($str) {
$op = array();
$pairs = explode("&", $str);
foreach ($pairs as $pair) {
list($k, $v) = array_map("urldecode", explode("=", $pair));
$op[$k] = $v;
}
return $op;
}
function get_url($query) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $query);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
return curl_exec($ch);
curl_close($ch);
}
if (isset($_COOKIE['mrc'])) {
$mrc = parseQueryString(urldecode($_COOKIE['mrc']));
$fr = array('app_id'=>$app_id, 'method'=>'users.getInfo','session_key'=>$mrc['session_key'], 'uids'=>$mrc['oid']);
$sign = sign_server_server($fr, $secret);
$rr = '';
foreach ($fr as $key => $value) {
$rr .= "$key=$value&";
}
$rurl = $url.'?'.$rr.'sig='.$sign;
echo get_url($rurl);
}
пилять 2 суток уже не сплю, а вот надо мне авторизроваться и инфу дернуть
{"error":{"error_msg":"Incorrect signature","error_code":104}}