There is a site and you can enter through VK. That is, when you enter, the following is transmitted:

http: //naklikay.ru/index.php? act = register & uid = 123456 & ...

When I write code on my website:

<? file_get_contents('http://naklikay.ru/index.php?act=register&...'); ?> 

Then he stupidly again displays this login form. In a word, I need to log in from my site to them. Can you tell me how to do it right?

    3 answers 3

    If it is necessary only for one account, you can do it in part-manually:

    1. Log in to that site through your vk account;
    2. pull out of the browser cookies related to the site and VKontakte;
    3. From your php script, pull the link is not file_get_contents , but use cURL and add the cookies saved in claim 1 to the request.

      No way to do this. The authorization buttons in the VC are made with javascript, that is, getting only one page through file get contents there won't even be this “Login via VKontakte” button, it will be generated later. Simulate clicking on it will not work. And using the VKontakte API, you can log in only for your site, which you need to pre-connect and confirm under your ownership (not sure about the latter, but it should be so). If everything were so simple, then there would be no security.

      Although, in fact, this is possible, but during authorization there is naturally a hash, which contains the URL of the site from which authorization was made.

      • @dydydydym, and if for example to install cookies that are saved during authorization on the site naklikay.ru? Although probyval and nothing happened .. - ModaL
      • There are different cookies for each site. - Shevsky

      In this way, you are unlikely to succeed. Here is described how to create authorization on the site through the contact

      • @atnartur, I need to log in to a third party from my site, where the VK authorization form is installed. - ModaL