A
A
Alexander Kleoshin2015-12-04 10:07:55
In contact with
Alexander Kleoshin, 2015-12-04 10:07:55

How to track the fact of a post on the wall in VK?

Question to experts vk api. I have a website. What set of methods can I use to track if a user actually posted a link to a page on my site on their wall?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Kleoshin, 2015-12-14
@mxSandr

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//vk.com/js/api/openapi.js" type="text/javascript"></script>


<script language="javascript">
    $(document).ready(function () {

        VK.init({
            apiId: add_id //апп_иди :)
        });

        function wall(text) {
            VK.Auth.getLoginStatus();
            var session = VK.Auth.getSession();
            var owner = session.mid;



            var post = {

                owner_id: owner,
                message: text
            }

            VK.Api.call('wall.post', post, function (r) {
                if (r.response) {
                    console.log(r.response.post_id);
                }
            });
        }

        $('#vk_post').click(function(){
            wall('Текст для поста');
        });

    });


</script>

<img id="vk_post" src="http://hsto.org/storage2/7ac/0d8/26a/7ac0d826a596f4388cb537f04617fcfd.png"/>

In if (r.response) we look at what the user has reposted to us: 3

C
confirm2315, 2015-12-04
@confirm2315

If the site has user authorization through VK, then you can find a post through wall.search at a certain label, passing the user's token. If there is no such post, it means I didn’t post it, if there is, I posted it accordingly. You can also use wall.get, comparing the last few posts with the one you need.
If there is no authorization and the user's profile is closed, then nothing. If it is open, then you need to know its id and pass it as a special parameter in these requests.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question