Get Different Part from WordPress Post Url

As we know, if the domain name is, the default post url after you have installed the wordpress is:

Here are three parts: domain name;
glasses: wordpress category name;
women-eyeglasses: post last part url.

How to get them seperately then?

Get the full part from url:

<?php echo home_url( $wp->request );?>

Get category part from url:

<?php echo dirname(home_url( $wp->request ));?>

Get the post last part from its url: