Provide http service by wordpress plugin

Now I use the init hook to add my own process for the request, and then check the request should be handled by the plugin, if yes, process and exit, if not do nothing. Like this:

add_action('init',function(){
  if(should_intercepte_the_request()){
    //process that.
    //exit
    die("foo");
  }else{
    //do nothing
  }
});

Then you can access the http by: http://localhost

It is recommended that you check the request method, and some access token to make sure the requests are sent by a trusted source.

404 Not Found

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.