Get a blog's numeric ID from its URL.
<?php get_blog_id_from_url( $domain, $path ); ?>
<?php // For subdirectory installs $blog_id = get_blog_id_from_url("example.com", "/blog1/"); // For subdomain installs $blog_id = get_blog_id_from_url("blog1.example.com"); ?>
get_blog_id_from_url() is located in wp-includes/ms-functions.php