Support » Developing with WordPress » Processing 3rd Party POST requests in WP

  • My website will receive POST requests from another site on the internet, when a users data needs to be processed. Is there an example of WP registering to receive external POST requests from the internet and processing them using PHP?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Requests can be processed by any of the usual WP entry points. Any of the API endpoints could be used. A specific page with a custom template could be used. admin-ajax.php and admin-post.php are possibilities. You can also define your own custom API route/endpoint.

    Which is best to use depends on what sort of request is being made and what sort of response is expected. If the transmitted data is all in JSON format, an API endpoint is likely the best choice. If you’re able to specify an URL query string (or an “action” POST field) as part of the request that the 3rd party uses to access your site, then admin-post.php would be a good entry point when non-JSON data is involved.

    Thread Starter kspambot

    (@kspambot)

    I will be getting a small amount of data with the POST. I will check on admin-post.php. Thank you.

    K-

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.