How to receive data by http POST request

Ok, here’s my answer for what it’s worth.

I use this plugin:

https://github.com/dphiffer/wp-json-api

HOWEVER! This plugin was removed from the official plugin site for unknown reasons. But, I use it for a custom API so I don’t upload the built-in controllers and deactivate the core controller.

The way it works:

Write your own custom controller (pretty easy once you figure out how it works) and then you can send JSON to an API URL on your main site and spit out custom JSON results for the site accessing it. Each public function in the controller can perform different API tasks.

An example of what I use it for:

  • Handling the PayPal IPN for plugin purchases.
  • Automating the issuing of registration codes for premium plugins.
  • Automating plugin update checks for premium plugins.
  • etc.

The worst part about it, it works like a short_code. Meaning, the return of the function outputs the result. So, if you have a function that’s going to take a while to run, the calling site may be tied up for a while waiting for that result.

Hope that helps.