How to get list of posts from permalinks?

There are several ways to achieve this, depending on the permalink structure of your posts. Assuming the post slug is part of the permalink structure, you can get the post slug from the post URL and fetch the corresponding post by using WP_Query with the name-parameter. Let’s assume the structure of the URLs is http://example.com/{post_slug}/. We can fetch the slug by using parse_url and query the posts with that slug:

$url="http://example.com/my-post/";

$path = parse_url( $url, PHP_URL_PATH ); // Get URL path from URL
$slug = trim( $path, "https://wordpress.stackexchange.com/" ); // Trim slashes

$posts_query = new WP_Query( array(
    'name' => $slug
) );

if ( $posts_query->have_posts() ) {
    $postid = $posts_query->posts[0]->ID;
}