app_id = $app_id; $this->vk_id = $vk_id; $this->token = $token; if (!strstr($api_url, 'https://')) $api_url = 'https://'.$api_url; $this->api_url = $api_url; } function api($method,$params=false,$v=true) { if (!$params) $params = array(); $this->api_url= 'https://api.vk.com/method/'.$method.'.xml?'; $params['api_id'] = $this->app_id; if($v) $params['v'] = '5.34'; $params['lang'] = 'ru'; $params['access_token'] = $this->token; //$params['test_mode']='1'; ksort($params); $sig = $this->vk_id; foreach($params as $k=>$v) { $sig .= $k.'='.$v; } $params['sig'] = md5($sig); $res = Send_Post($this->api_url,$this->params($params),'https://vk.com/app'.$this->app_id.'_'.$this->app_id); return simplexml_load_string($res); } function params($params) { $pice = array(); foreach($params as $k=>$v) { $pice[] = $k.'='.urlencode($v); } return implode('&',$pice); } } ?>