On Wed, Jun 18, 2008 at 10:45 PM, Ethan Whitt <[EMAIL PROTECTED]>
wrote:

> Not sure how to achieve this.  How can I grab a portion of a URl to send to
> a .php script in this fashion?
>
> www.test.com/article/3435   <- Grab the "3435" to process in a script?


take a look at the $_SERVER superglobal array,

http://www.php.net/manual/en/reserved.variables.server.php

most likely you are looking for, $_SERVER['PATH_TRANSLATED'], but it really
depends on what you want out of the url, so make sure to read through the
options, and their explanations.  those values are just strings, so its
quite easy to extract portions of the string using a variety of techniques.
for example, give the url in your question (suppose we find it in
$_SERVER['PATH_TRANSLATED'])

$lastPath = substr($_SERVER['PATH_TRANSLATED'],
strrpos($_SERVER['PATH_TRANSLATED']), '/') + 1); // $lastPath = '3435'

-nathan

Reply via email to