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.
+1
A:
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).
Stewie
2010-09-22 17:06:09
@Stewie. I think I need to create an API but it sounds complicated. Do you know any document on that topic? Do I need to use REST?
azam
2010-09-23 08:11:48
REST is a concept (or a design architecture style), basically its about using a common communication (plaintext, XML, json etc) to communicate between two systems. Normally XML is used as there are lot of vendors creating and using XML. This is one of the best and simplest tutorial on creating API in PHP. It uses XML. http://www.codewalkers.com/c/a/Miscellaneous/Create-Your-Own-Custom-API/
Stewie
2010-09-23 16:53:03
@Stewie. Thank you so much for your help.
azam
2010-09-26 03:05:59