I develop a plugin designed for WordPress. I want to know who uses my plugin. There are install and uninstall hooks in WP. So every instance of my plugin can do a "pingback" to my server when it is activated or deactivated. But I do not know how to make it. Any ideas? Thank you!
Have a script that writes to your mysql server every time it's installed with the domain name of the server. Should be as simple as that really, then just get the list from your mysql table
Well how about you stick something in the plugin so that when a visit views the content, it sends a request to your callback URL on your server, so you can tell which sites are actively using your plugin, and then refresh the list using some kind of cron on your server that if the callback isn't recieved within the past 24 hours, it can remove the URL assuming it isn't actively using the plugins anymore. If you want me to elaborate, I am happy to go over my idea further, but it goes like this for basics: function chckforactive($content){ //send a message to your server or site return $content ; } then add the action so it parses the content (this way when a user views the content while your plugin is installed, your server will get a message) then on your site have a script to recieve the data you're sending. you may wish to extend past 24 hours just to allow for smaller sites to be known. just make sure that they aren't aware you're doing it, or you may just get sites adding and then removing your plugin to get a free backlink
Doing something like Grit suggested could be very bad for the performance of the server that would receive daily pings from potentially thousands of servers (depending upon how popular your plugin is). Stick to the on activate/deactive method. Example: -------- site -------- | myPluginID | anotherPluginID | ... urlencodedurl.com | ---- 1 -----| -------- 0 ------- | ... Possible values for myPluginID, anotherPluginID, ... = 0: never activated, 1:activated, 2:decativated In your activation function: 1. url encode the users site url 2. ping your server's script like this: example.com/activated.php?plugin=myPluginID&site=urlencodedurl.com&status=1 In your deactivation function: 1. url encode the users site url 2. ping your server's script like this: example.com/activated.php?plugin=myPluginID&site=urlencodedurl.com&status=2 Create a database table for site 'profiles' in your activated.php file: 1. Check for occurrence of site ($_GET['site']) in your database 2. If site not found add a new row/profile for it 3. check site's profile for plugin 3. if no occurrence found, add new plugin to sites profile 4. Check status ($_GET['status']) and update the plugin's status under the site's profile accordingly (1:activated, 2 deactivated) In summary the script will create/update a site's profile in your database that will include which plugins a site is using and what the last known status of that/those plugin(s) is/are. Anyway that's how I'd begin to do this.