Use the HTTP API to send a “ping” on the wp_insert_post
action, which is fired whenever a post is created/updated:
/**
* @param int $post_id The ID of the post.
* @param WP_Post $post The post object.
* @param bool $update True if the post already exists and is being updated
*/
function wpse_185340_post_ping( $post_id, $post, $update ) {
if ( $post->post_status === 'publish' ) { // Only fire when published
wp_remote_post(
'http://example.com/application/notify',
array(
// https://codex.wordpress.org/HTTP_API
'blocking' => false, // If you don't need to know the response, disable blocking for an "async" request
'body' => array(
'post_id' => $post_id,
'post' => json_encode( $post ),
'update' => ( int ) $update,
// or whatever
)
)
);
}
}
add_action( 'wp_insert_post', 'wpse_185340_post_ping', 10, 3 );