Does facebook Like Button return any value (PHP)?

ε祈祈猫儿з 提交于 2019-12-04 17:14:43

You'll have to use the Javascript API to do this:

FB.Event.subscribe('edge.create',
    function(response) {
        console.log("Here is the response %o", response);
    }
);

AFAIK, "FB Like" is JavaScript addon (not PHP), but you could bind JS event to like button, that would send some AJAX data to your server, notifying it, about usage of Like button. Even thou, I'm not sure about my answer.

You can subscribe to events edge.create and edge.remove they are used for tracking the firing of liking and unliking events respectively..

as a simple check add alert() in the response function to see if you got it right..

   FB.Event.subscribe('edge.create', function(response) {
    // A user liked the item, read the response and handle
    alert("like event detected");
  });

 FB.Event.subscribe('edge.remove', function(response) {
    // A user liked the item, read the response and handle
    alert("unlike event detected");

  });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!