Solution:1
I found, we can create rest api and use it, here what i did with rest api Need to use it with this URL : http://localhost/wordpress-o/wp-json/my-route/my-phrase
function my_register_route() {
register_rest_route('my-route', 'my-phrase', array(
'methods' => 'GET',
'callback' => 'custom_phrase',
)
);
}
function custom_phrase() {
return rest_ensure_response('Hello World! This is my first REST API');
}
add_action('rest_api_init', 'my_register_route');