How to find mutual friends in VKontakte. How to end a relationship without losing mutual friends

Hello, habrowser.
One day I had a need to find a person, knowing his appearance and knowing about his membership in a certain club. I also owned the addresses (VKontakte) of the pages of two other club members. Almost certainly the person they were looking for was a friend of each of them. This problem could be solved in different ways. In the article I will write about how I implemented the solution using the vk.com API.
1.Task
Create a service that will find all the mutual friends of two individual users, without requiring verification and a social network account for service users. Get information about mutual friends:
  • photo
Implement a task based on the VKontakte API. Write a hotel class for this.
2.Solution
2.1.Defining the necessary API methods
Let's go to list of methods API. And after searching, we find what we need.

There is a method to get user's friends friends.get.
friends.get - returns a list of the user's friend IDs or extended information about the user's friends (if the fields parameter is used).

And, what is important, as part of the solution to the task at hand, this is an open method that does not require an access_token.

There is only one required parameter:

Using this method, it is possible to obtain information about all friends of each of our two sets, but this approach will not be optimal. User A can have 2000 people as friends, but only 3 people will intersect with the friends of user B. In this case, information about 1997 users will be unnecessary to us, and the resources spent on obtaining it will be wasted.
We will only request user IDs, and having received the numbers we need (which belong to the set A and B), we will select information from them.

There is a method to get information about the user users.get.
users.get -Returns extended information about users.

This method also does not require an access_token, which means it is ideal for our task.


In user_ids we will pass an array of user IDs that appear in both sets.
We want to receive only an avatar of size 100*100, for this we will pass the value photo_100 in the fields parameter.

2.2. Let's move on to the practical side
I wrote a simple class in php:

Class VkFriends ( public function clean_var($var) ( $var = strip_tags($var); $var = preg_replace("~\D+~", "", $var); $var = trim($var); return $ var; ) public function get_friends($u_id) ( $friends = file_get_contents("https://api.vk.com/method/friends.get?user_id=".$u_id); $friends = json_decode($friends); if(!isset($friends->error))( return $friends; )else( return ""; ) ) public function mutual_friends($friends) ( $mutual = array_intersect($friends->response, $friends->response ); if(!empty($mutual))( return $mutual; )else( return ""; ) ) public function get_users_info($users) ( $u_ids = implode(",",$users); $u_info = file_get_contents ("https://api.vk.com/method/users.get?user_ids=".$u_ids."&fields=photo_100"); $u_info = json_decode($u_info) public function view_user_info( $u_info) ( $uid = $u_info->uid; $first_name = $u_info->first_name; $last_name = $u_info->last_name; = $u_info->photo_100; print("

"); ) public function view_users_info($users_info) ( for($i=0;$i response);$i++)( $this->view_user_info($users_info->response[$i]); ) ) )

Now let's look at our class in action:

$vkf = new VkFriends; $u_id = $vkf->clean_var($_POST["u1"]);//clean variables from POST $u_id = $vkf->clean_var($_POST["u2"]); if(($u_id!="")&&($u_id!=""))( echo "

"; $friends = $vkf->get_friends($u_id);//getting friends list from user with u_id $friends = $vkf->get_friends($u_id); if(($friends!="")&&($ friends!=""))( $mutual = $vkf->mutual_friends($friends);//create new array from intersect arrays if($mutual!="")( $users_info = $vkf->get_users_info($mutual );//getting info about users that are mutual $vkf->view_users_info($users_info);//view information about selected users )else( print("

Mutual VK friends help users actively expand their social circle. This category includes users who are friends with both you and the owner of the page you are viewing.

See common ones on VK quite simple. To do this, you need to go to the user’s page and pay attention to the menu under the avatar. The first block is called “Mutual Friends,” where users from this category are displayed. There is another way that will also not cause any difficulties. Having entered the person’s page, click on the section with his friends. At the top of the screen, find the “Mutual Friends” tab. If you wish, you can quickly add as friends those of them who you like most.

Attention! The list of possible friends is formed based on “common” ones. First of all, it includes those people with whom you are connected through the maximum number of comrades.

Mutual friends of two people on VK

At the moment there is an interesting way to see mutual friends between two VKontakte users. We are talking about service 220 vk.com. Here are short instructions on how to make working with VK even easier:

  • We go to the website vk.com.
  • We see two fields on the screen. In the first we write the identification code (ID) of one user, in the second - the code of another. If desired, instead of the ID, you can replace it with links to them copied from the address bar of the browser.

    Click on the “Search for mutual friends” button and get the result.

In addition, the site can calculate the user’s hidden friends VK, find out the blacklists you are on, and also identify users who have added you to “hidden friends”.

Here, perhaps, is all the information about what mutual friends on VKontakte are, what they are for, and how to view them. All that remains is to apply the acquired knowledge in practice, expanding your opportunities for communication on the social network.

The social network VKontakte unites people, and various algorithms are constantly being introduced into it to make it more convenient for users to find their friends, relatives and simply acquaintances with whom they may have seen several times, but upon meeting did not have time or did not want to add each other as friends . One way to quickly add new people to your friends list is to use the VKontakte “Possible Friends” tool. In the article, we will consider the principle of operation of this algorithm, as well as how to use it.

How to see possible friends on VKontakte

To see the users whom the VKontakte social network considers to be your potential friends, just go to the “Friends” section on your page. In the lower right corner of the page that opens, under the filtering lists of current friends, the “Possible friends” block will be located.

Every time you visit the page, it is formed in a new way. This block displays 5 people you may know. If you want to see more possible friends, click on the “Show all” button in this block.

After this, a page will open that displays all the users who are defined as possible friends for your page. Depending on how actively you use your VKontakte account, as well as on a number of other factors, the amount of user data may vary. Scroll down the page and new prospective friends will be loaded automatically.

Please note: Although this page has various filters at the top and right, they in no way allow you to filter the list of possible friends. That is, if you use the search above and, for example, try to find all possible friends with the name “Sergey”, the social network will simply start looking for users with the name “Sergey” in its database, without focusing on the list of possible friends selected for you.

How are possible VKontakte friends determined?

The VKontakte company does not disclose the algorithms by which the list of possible friends is formed for each specific user. However, observations show that the list of possible friends clearly depends on:

It is important to note that the user does not have the ability to see who they are listed as a supposed friend for. That is, this information is not mutual for users. If you see that a VKontakte user is listed as a possible friend, for example, because you often visit his page, this does not mean that he will list you as a friend. Of course, with the exception of the situation when, when you visit a page, you show activity on it in the form of likes, reposts, comments, and so on.

The social network VKontakte is exactly the place where we correspond with friends, listen to our favorite music, watch various videos, and also find new acquaintances, friends and even a soulmate. There are even some unwritten rules about who should write to whom first, who should be added to whom first, and so on.

After meeting a person again, the first thing we all do is go to our favorite social network and try to find his or her profile. But, unfortunately, this is sometimes quite difficult to do. The most reliable way is to search through mutual friends. And in this article we will tell you how to find mutual friends on VKontakte and how to do it correctly and as quickly as possible.

Search through "My Friends"

According to the theory of six handshakes, absolutely any two people on earth are separated by no more than five acquaintances, and, accordingly, there are no more than six levels of connections between them. Thus, it is likely that the person you met recently knows one of your friends on VK. Therefore, it is quite logical to search for a person on your friends’ friend lists. But if you check everyone, it will most likely take a lot of time, right?

So, in order not to waste your time and nerves, you need to follow the steps described below. First you need to go to the “My Friends” section. Then you should enter the last name or first name of the person you want to find. In the “Other Users” subsection, people from the friend lists of your friends on VK will first be displayed. This way, if someone on your friends list has a person, he will be displayed in the first places. And then all other users of the social network with the same first or last name will be located.

You can also use the advanced search on the right. There you can enter such search parameters as the city, age and gender of the person you are looking for in order to significantly reduce the list of found users and thereby reduce the time spent on this.

Possible friends

Another reliable way to find mutual friends on VK is to use a special search section called “Possible Friends.” To do this, you need to follow this link: http://vk.com/friends?act=find. It will display a list of those users with whom you have mutual friends, making it likely that you also know them. In this case, the exact number of mutual friends will be indicated there. For example, “Olga Ivanova. You and Olga have 12 mutual friends.”

In the Possible Friends section, you can also immediately add a person to your friends list if needed. There is no need to go to her/his page for this. Under the phrase “You and Olga have 12 mutual friends” there is a button “Add as friends”, by clicking on which you will send a request to the user.

Thus, you learned how to find mutual friends on VKontakte much faster. For many of us, every minute counts, and therefore we don’t want to waste a lot of time on a tedious search for the person we need on this site. We hope that the article was useful to you and communication on VK will become even simpler and more convenient for you.

Sometimes it is very interesting to see who your friend adds as a friend on the VKontakte social network. Someone wants to find out who his wife is making friends with, someone is not indifferent to the social circle of their own children. There are many similar reasons. Previously, this information could not be found out; today it is not difficult to do. This article will tell you how to find out on VK who a friend has added as a friend, as well as what else you can see on the friends page.

In order to view information about friends that interests us, we will use the view of updates on the site.

VK updates provide various information to the user: what photos were uploaded to, in which you are a member, what is happening on the pages you are subscribed to, etc.

To open a name search, press Ctrl+F and enter a phrase, which is the name, or in some cases a nickname, of the person you want. But there are conditions under which this method will not work. A user we are interested in can refuse to show friends they add in their settings in their news feed. But fortunately, not all users know about this setting, so it is used extremely rarely. To do this, you need to go to the privacy section. And remove the corresponding checkmarks.

Important friends on a friend’s page on VKontakte

Not all users know that the size of the friends list has a limit of 10 thousand. Although most of the list does not exceed 300 people. Perhaps you have ever wondered how friends are distributed in it? By looking at your page, you can easily understand that those with whom you communicate most often are in the top. But there are times when a person with whom you have not communicated for a long time ends up at the top. These are the accounts you most often visited, commented on, and viewed photos. Also, recently added friends get to the top; if your activity on their page decreases, they will move down the list.

But when you open your friend's page, you will notice that the friends on it are distributed differently. You will come first. Next are mutual friends with this user; the more mutual friends a user has in the list, the higher this user is in your friend’s list. When there are no more mutual friends, users will be placed on the friend’s list according to the date of registration in VK. Therefore, the importance of friends in your friend's list cannot be found out in the usual way. This suggests that user privacy is important to the social network.

How can I view photos that a friend has closed for public viewing?

Locked photos can be viewed thanks to the innovation of the “Accelerated Photo Viewing Mode” service.

  • We enable a new feature (accelerated photo viewing mode).
  • Go to the item “Photos in which the user is tagged” (you need access to this section, otherwise it won’t work).
  • We select any open photo and view it together with closed ones, as in normal mode. All photos from the closed album will be available.

This method is possible due to the “crooked” development of this function by VK programmers. Most likely, this “bug” will be fixed in the future, but for now you can use it.

Access to a friend’s private sections on VK

One of the most popular and interesting topics is access to closed pages and sections in VK. Sometimes friends close sections on their page, for example: audio recordings or photos. But they still understand that closed means something interesting. You can satisfy your curiosity with the help of small manipulations with the address bar of your browser on the VKontakte page.

Each user has his own ID. Who else doesn’t know what an ID is - it’s a unique number that is assigned to each user. In the browser line it looks like this: https://vk.com/id356849341. Each section has its name on a line, after the main domain and a slash. For example, it looks like this: https://vk.com/audios. By combining the friend's ID and the name of the section in the browser line, we will gain access to the closed section. Thus, you can access any closed profile and section by combining the section name in Latin and the user number.

In contact with