tags:

views:

61

answers:

2

How to find whether url is exist or not ? i.e url that leads to 'page not found' error . for ex: finding test/testpage is exist or not

i mean that to check whether given relative path or full path is really exist on the site or it leads to page not found error

+2  A: 

You can use the menu_valid_path() function for this. This returns TRUE or FALSE based on 1. Whether the menu path exists and 2. if the current user has permission to view the item.

You call it like this:

$item_exists = menu_valid_path(array('link_path' => $some_path));

Where $some_path is the path you want to test.

alxp
+1  A: 

Also you can use requesting page: http://api.drupal.org/api/function/drupal_http_request/6
On error you will get not empty $result->error.

Nikit

related questions