Hello.
The site has a VK comment widget https://vk.com/dev/Comments
How can you make it so that when you add a comment to this widget, this very comment will automatically be published on the wall of a certain group?
thank
Hello.
The site has a VK comment widget https://vk.com/dev/Comments
How can you make it so that when you add a comment to this widget, this very comment will automatically be published on the wall of a certain group?
thank
This widget generates various events : when sending a comment and when deleting a comment. You need to catch the comment posting event using the VK.Observer.subscribe() method and inside it make an AJAX request for your VK import script:
VK.Observer.subscribe('widgets.comments.new_comment', function(num, last_comment, date, sign) { // здесь ваш AJAX-запрос }); Inside the AJAX request, transfer all 4 parameters that you will receive when the user leaves a comment (see the comment widget events ), and then, before publishing a comment on the wall, check the validity of the sign parameter using the md5($api_secret.$date.$num.$last_comment) scheme md5($api_secret.$date.$num.$last_comment) , where $api_secret is the secret key of your application, which can be found in the settings. This is a digital signature that ensures that the person actually left an entry in the comment widget and did not forge an AJAX request. In simple words: you need to check whether the MD5 code you received is equal to the sign parameter. If it is equal, then the digital signature is valid, which means that you can safely post a comment on the group wall.
Source: https://ru.stackoverflow.com/questions/590480/
All Articles