phpdigg

Create button like Digg button


I am building a news aggregator. How can I create button/ widget like Digg button or Facebook Share button that web developer can embed in their own website. When their users click on that button, it can trigger some function that interact (eg: voting or display vote amount) with my server. Thank you.


Solution

  • Simple solution: You need PHP script that accepts GET parameters. The third party can send data payload in the GET parameter and your script can read them and do the needful.

    Voting third party via button shouldn't be done via GET params. This will create bad voting attacks. What you can do is make an API for your third party systems and have them do a CURL request to your API with the POST data payload. Again, this isn't the most secure. To make it more secure, use the API key and domain / IP check.

    If your system is based on user sessions, you can do a cookie check to determine USER Information and read values. (similar to facebook LIKE).