I want to create a wordpress plugin that can catch POST/GET requests to a certain URL from outside, such that I can have external PHP code POSTing data to the wordpress plugin, which the plugin can then further handle internally.
I don’t want to create blog posts or pages from outside, I know the XML-RPC interface exists for that. I’m talking about posting data from outside into wordpress and then handling it further within a plugin.
I guess I could also directly connect to the WP DB but that is probably not a very clean solution and might break if I upgrade WP.
As you already know about WordPress XMRPC: Your plugin can register own functions for XMLRPC that listen to the request then. You can send a POST request to the XMLRPC endpoint then and the plugin function will be triggered then.
The following code-example is a simple plugin class that registers a function to the XMLRPC endpoint
my.recieve. It shows how the callback function is registered to that string:If you dislike the XMLRPC overhead, you can just create a PHP file part of your plugin and request it. Then you need to take care yourself to load all WP functions you might want to use (e.g. database access etc.).