Wordpress developers. I have a problem with Wordpress Rest API. I want to get the referrer host(url, domain) that call wp rest api on Rest server side. For example, domainA.com send request using wp_remote_request('domainB.com/wp-json/myurl') and I want to get domainA.com. How can I get it on wordpress rest api side? using which hook? Can I get it on "rest_api_init" hook or on its callback function?
add_action( 'rest_api_init', array( $this, 'plugin_rest_api_endpoint' ) );
public function plugin_rest_api_endpoint( $server ){
register_rest_route( 'link_manager', '/get_links', array(
'methods' => 'GET',
'callback' => array($this, 'plugin_process_client_request'),
) );
//Get domainA.com from here.
}
or
public function plugin_process_client_request($data){
//Get domainA.com from here
}