V
V
Vlad2016-05-16 14:18:11
In contact with
Vlad, 2016-05-16 14:18:11

Is such a request to Api Vkontakte possible?

Here is my code in which I want to get a list of "friends of friends of a particular person" IDs. The for loop can be repeated about 500 times, so making 500 api.vkontakte.ru/method/friends.get requests takes a very long time.
I was prompted that it is possible to make a request through the stored procedures execute .
To do this, you need to create an application, go to stored procedures and create a "new procedure", where to register my request to api.
Question: Is it even possible to inject my code into stored procedures if I use the $_GET["userid"] dynamic variable ? That is, I cannot enter specific numbers into the procedures in advance .. they are always different, because variable $_GET["userid"
How to proceed?

$resp = file_get_contents('https://api.vkontakte.ru/method/friends.get?user_id='.$_GET["userid"].'');
    $data = json_decode($resp, true);
    print count($data[response]);
    for($i=0;$i<count($data[response]);$i++){
        $resp2 = file_get_contents('https://api.vkontakte.ru/method/friends.get?user_id='.$data[response][$i].'');
        $data2 = json_decode($resp2, true);
        $friends .= implode(",", $data2[response]).",";
    }
    print $friends;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question