How I’ll get an entryId based on a given URL?
I'm assuming that "welcome" is also your page slug.

You could query the craft_elements_i18n table (pseudo code):

$sql = "select id from craft_elements_i18n where slug = 'welcome' limit 1"
$result = get($sql);
$entry_id = $result['id'];


Then feed that into your function.
Replace 'welcome' with a read of the uri to make it dynamic.