使用wp_router_generate_routes时如何获取请求URL和请求正文

I'm new to use php and wordpress, see this article to add route to wordpress, the code like:

add_action( 'wp_router_generate_routes', 'bl_add_routes', 20 );

function bl_add_routes( $router ) { 
    $route_args = array(
                        'path' => '^new-demo-route',
                        'page_callback' => 'my_callback'
                );

    $router->add_route( 'demo-route-id', $route_args );
}

function my_callback( ) {
    return "Congrats! Your demo callback is fully functional. Now make it do something fancy";
}

If in client, I use curl my-domain/new-demo-route?param_key=param_value -d "{ctn: 'here is body'}"

in my_callback, how to get request url and request body

I find the solution:

get request url:

$this_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"

get request body(only work for post request)

file_get_contents('php://input')