M
M
Matthew Stafford2019-04-10 16:24:55
PHP
Matthew Stafford, 2019-04-10 16:24:55

VK API execute + PHP, how to do it right?

Hello everyone, I have the following code for execute

var request = "members";

if (request == "members") {
     var members = API.groups.getMembers({"group_id":"123456","v":"5.92"});
     return members.count;
} else if(request == "managers") {
     var managers = API.groups.getMembers({"group_id":"123456","filter":"managers","v":"5.92"});
     return managers.count;
} else if (request == "requests") {
     var requests = API.groups.getRequests({"group_id":"123456","count":"0","v":"5.92"});
     return requests.count;
}

Question: how can I change the variable from the first line in my PHP code without making three requests? Is this even possible or am I misunderstanding something?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stockholm Syndrome, 2019-04-10
@matthewstafford

if you have your own application, then you can use stored procedures
https://vk.com/editapp?id={your_app_id}§ion=fu...
then you can create an execute.getCount procedure that will have a request
PS parameter inside execute no need to pass version when calling methods

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question