Re: Parsing URLs

From: Date: Tue, 28 Oct 2008 02:21:13 +0000
Subject: Re: Parsing URLs
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-282526@lists.php.net to get a copy of this message
On Mon, Oct 27, 2008 at 10:04 PM, Ron Piggott <ron.php@actsministries.org> wrote: > I would like to parse the URLs in the values after the domain name. > > The URLs are the results of mod re-write statements. > > Example 1: > > http://www.domain.com/page/file/ > > The desired results would be: > $web_page_access[1] = "file" > > Example 2: > > http://www.domain.com/page/file/2/ > > The desired results would be: > $web_page_access[1] = "file" > $web_page_access[2] = "2" > > Any help please? > > Ron > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > // $uri = htmlspecialchars($SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8'); $uri = htmlspecialchars('/page/file/2/', ENT_QUOTES, 'UTF-8');; $uri = trim($uri, "/"); $parts = explode("/", $uri); var_dump($parts); or use parse_url to get down to the bits you need.

« previous php.general (#282526) next »