$attach = 'photo-151833540_456239046'; // тут может быть любая картинка
$attach = 'photo-151833540_456239010';
$v->msgsend($msg, $uid, $token, $attach);
public function msgSend($msg, $uid, $token, $attachment){
$request_params = array(
'message' => $msg,
'attachment' => $attachment,
'user_id' => $uid,
'access_token' => $token,
'v' => self::API_VERSION
);
$get_params = http_build_query($request_params);
file_get_contents(self::METHOD_URL."messages.send?".$get_params);
}
}elseif (strpos($user_msg, 'команда') !== false) {
$v->msgsend($msg, $uid, $token, 'photo-153335667_456239039');
}elseif (strpos($user_msg, 'porno') !== false) {
$attach = [
[
"type" =>"photo",
"photo" => ['photo-151833540_456239046'],
],
];
$v->msgsend($msg, $uid, $token, $attach);
public function msgSend($msg, $uid, $token, $attachment){
$request_params = array(
'message' => $msg,
'attachment' => $attachment,
'user_id' => $uid,
'access_token' => $token,
'v' => self::API_VERSION
);
$get_params = http_build_query($request_params);
file_get_contents(self::METHOD_URL."messages.send?".$get_params);
}
class vk {
const API_VERSION = '5.24';
const METHOD_URL = 'https://api.vk.com/method/';
public function get(){
return json_decode(file_get_contents('php://input'));
}
public function usersGet($uid){
return file_get_contents(self::METHOD_URL."users.get?user_ids={$uid}&v=".self::API_VERSION);
}
public function msgSend($msg, $uid, $token){
$request_params = array(
'message' => $msg,
'user_id' => $uid,
'access_token' => $token,
'v' => self::API_VERSION
);
$get_params = http_build_query($request_params);
file_get_contents(self::METHOD_URL."messages.send?".$get_params);
}
class vk {
const API_VERSION = '5.24';
const METHOD_URL = 'https://api.vk.com/method/';
public function get(){
return json_decode(file_get_contents('php://input'));
}
public function usersGet($uid){
return file_get_contents(self::METHOD_URL."users.get?user_ids={$uid}&v=".self::API_VERSION);
}
public function msgSend($msg, $uid, $token){
$request_params = array(
'message' => $msg,
'user_id' => $uid,
'access_token' => $token,
'v' => self::API_VERSION
);
$get_params = http_build_query($request_params);
file_get_contents(self::METHOD_URL."messages.send?".$get_params);
}