$h = file_get_contents("https://api.vk.com/method=utils.resolveScreenName&...");
$request_params = array(
'screen_name'=> $links,
'access_token' => $token
);
$get_params = http_build_query($request_params);
$h = json_decode(file_get_contents('https://api.vk.com/method/utils.resolveScreenName?' . $get_params ));
m/method=utils.resolv
m/method?utils.resolv
$res =
$res2 =
$res = json_decode(file_get_contents(
'https://api.vk.com/method/photos.getWallUploadServer?group_id='
. $group_id . '&access_token=' . $access_token
));
$res = json_decode(file_get_contents(
'https://api.vk.com/method/photos.saveWallPhoto?group_id=' . $group_id
. '&server=' . $res->server . '&photo='
. stripslashes($res->photo) . '&hash='
. $res->hash . '&access_token=' . $access_token
));
<html><body>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<?php
//Твой токен
define('token_user', '76305ff9beaa4ae1a4fea541');
// Часовой пояс
date_default_timezone_set('Europe/Volgograd');
// Дата дембеля
$_dembel = '2017-11-25';
$today = date('Y-m-j');
$datetime1 = date_create($today);
$datetime2 = date_create($_dembel);
$interval = date_diff($datetime2, $datetime1);
$_status = $interval->format('%R%a дней до дома =)');
function metog_get ($_metod= null, $_paramm = null) {
$url = trim($_metod.http_build_query($_paramm));
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl);
curl_close($curl);
if ($data != null) {
return $data;
} else {
return 'Error = ' .$data;
}
}
$_param = array('text' =>$_status ,
'access_token' =>token_user
);
$_response = metog_get('https://api.vk.com/method/status.set?',$_param);
//"response": 1
$_id_status = json_decode($_response)-> response;
if (is_int($_id_status) == 1 ) {
echo 'OK = ' .$_status ;
} else{
echo ('Er = '.$_id_status);
}
?>
</body>
</html>
while ($cur_offset < $_offset){
$_12000 = $cur_offset + 12000;
$_test = $_vkapi -> execute (
'var members = [];'.
'var obj =[];'.
'var offset ='.$cur_offset.';' .
'while (offset < '.$_12000.')'.
'{'.
'members = API.likes.getList({"type":"post","owner_id":'.$_id_gr.',"item_id":'.$_id_post.',"count":1000,"offset": offset}).items;'.
'obj = obj + API.users.get({"user_ids":members,"fields":"sex, bdate, city, country"});'.
'offset = offset + 1000;'.
'};'.
'return obj;'
);
$_resp =json_decode($_test);
foreach ($_resp->response as $_anse) {
if (is_int($_anse ->sex)) {
$_sex = (int) ($_anse ->sex);
switch ($_sex) {
case 0:
$_other++;
break;
case 1:
$female++;
break;
case 2:
$male++;
break;
default:
//$_other++;
break;
}
}else{
$_other++;
}
}
}
[ 13:16:59] Text: $female=5115 $male=6885 $_other=0 $itogo=12000
[ 13:17:12 ] Text: $female=15588 $male=23570 $_other=6 $itogo=39158
private $token = 'хххххххххххххххххххххххххххххххххххххххххххххххх';
private $_ok = 'OK';
public function messages_send ($paramm = []){
if (!$paramm) {return false;}
else {
$url = trim('https://api.vk.com/method/messages.send?'.http_build_query($paramm));
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl);
curl_close($curl);
// curl_setopt($curl, CURLOPT_ENCODING ,"");
$_id_message = json_decode($data)->response;
if (isset ($_id_message)) {
if (is_int($_id_message)){
return $this->_ok;
}
} else {
return $data;
}
}
}
case 'group_leave':
$request_params = array (
'message' => 'Ливнул',
'user_id' =>$callback_object->object->user_id,
'access_token' => $this->token,
'read_state' => 1,
);
return $this-> messages_send ($request_params);
break;
case 'group_join':
$request_params = array (
'message' => 'Добро пожаловать!',
'user_id' =>$callback_object->object->user_id,
'access_token' => $this->token,
'read_state' => 1,
);
return $this-> messages_send ($request_params);
break;