In D7, how do I check whether a page exists by page alias? I've found some guy asking the same very question but I have problems with using menu_valid_path() (or drupal_valid_path() in D7) function. It always returns TRUE, no matter how weird a path I pass to it. Here is a sample code:
if(drupal_valid_path($GLOBALS['base_url'] . '/contacts')) //this exists
{
print_r('Exists!');
}
if(drupal_valid_path($GLOBALS['base_url'] . '/weird_alias')) //this doesn't exist
{
print_r('Exists!');
}
I get two "exists" despite the fact that /weird_alias page doesn't exist and returns a "page not found" error. I'm extremely reluctant to use drupal_http_request() because there are a lot of unnecessary things like headers, timeouts etc. Shouldn't there be an easier way to check internal paths?