Re: [PHP] URL Parsing...

2007-11-26 Thread Jochem Maas
Richard Heyes wrote: > Chris wrote: >> Richard Heyes wrote: well if you take a string (filename) and wish to change the end of it somone then I don't think str_replace() is the correct function. what's to say a script doesn't exist called 'my.cfm.php'? >>> >>> How does this

Re: [PHP] URL Parsing...

2007-11-26 Thread Richard Heyes
Chris wrote: Richard Heyes wrote: well if you take a string (filename) and wish to change the end of it somone then I don't think str_replace() is the correct function. what's to say a script doesn't exist called 'my.cfm.php'? How does this: /\.cfm$/ take into account that? $ in regex's

Re: [PHP] URL Parsing...

2007-11-25 Thread Chris
Richard Heyes wrote: well if you take a string (filename) and wish to change the end of it somone then I don't think str_replace() is the correct function. what's to say a script doesn't exist called 'my.cfm.php'? How does this: /\.cfm$/ take into account that? $ in regex's means 'end of

Re: [PHP] URL Parsing...

2007-11-25 Thread Jochem Maas
Richard Heyes wrote: >> well if you take a string (filename) and wish to change the end of it >> somone >> then I don't think str_replace() is the correct function. what's to >> say a script >> doesn't exist called 'my.cfm.php'? > > How does this: > > /\.cfm$/ > > take into account that? WTF >

Re: [PHP] URL Parsing...

2007-11-25 Thread Richard Heyes
well if you take a string (filename) and wish to change the end of it somone then I don't think str_replace() is the correct function. what's to say a script doesn't exist called 'my.cfm.php'? How does this: /\.cfm$/ take into account that? -- Richard Heyes +44 (0)800 0213 172 http://www.webs

Re: [PHP] URL Parsing...

2007-11-25 Thread Jochem Maas
Richard Heyes wrote: >> one of these should give you something to go on: >> >> echo preg_replace('\.cfm$', '-meta.cfm', >> parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)), "\n"; >> echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['PATH_TRANSLATED']), >> "\n"; >> echo preg_replace('\.cfm$', '-met

Re: [PHP] URL Parsing...

2007-11-25 Thread Richard Heyes
one of these should give you something to go on: echo preg_replace('\.cfm$', '-meta.cfm', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)), "\n"; echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['PATH_TRANSLATED']), "\n"; echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['SCRIPT_FILENAME']), "

Re: [PHP] URL Parsing...

2007-11-24 Thread Jochem Maas
Amanda Loucks wrote: > Hi, > > I'm working on redesigning the backend of the website for work. It was > originally done in ColdFusion, but I'm switching it over to PHP - probably > going to transfer the website from where it's currently hosted to something > a lot cheaper, too, hence the switchin

Re: [PHP] URL Parsing...

2007-11-24 Thread tedd
At 12:18 PM -0600 11/24/07, Amanda Loucks wrote: Hi, I'm working on redesigning the backend of the website for work. It was originally done in ColdFusion, but I'm switching it over to PHP - probably going to transfer the website from where it's currently hosted to something a lot cheaper, too,

Re: [PHP] URL parsing

2002-12-18 Thread 1LT John W. Holmes
> http://www.php.net/manual/en/function.parse-url.php If you're going to help, at least read the question. The poster already said they tried that and it's not even a solution, anyhow. The "username" it refers to in parse_url() is for URLs in the format of http://username:[EMAIL PROTECTED]. > >ht

Re: [PHP] URL parsing

2002-12-18 Thread Tim Ward
you could use a combination of the string functions (strstr(), substr(), strpos()) or you could work out something with regular expressions. Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] - Original Message - From: Mako Shark <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent:

Re: [PHP] URL parsing

2002-12-18 Thread Wico de Leeuw
http://www.php.net/manual/en/function.parse-url.php At 06:39 18-12-02 -0800, Mako Shark wrote: I've got a URL like this: http://www.naturalist.com/~fungae/index.php which is stored in $http_referer (as parse_url from $HTTP_REFERER). I'm trying to extract the username (~fungae). I've read the do

Re: [PHP] URL Parsing Help

2002-01-29 Thread Shane Lambert
Actually, I found a simpler way: $vars = str_replace("/","&",$PATH_INFO); parse_str($vars); But thanks for your help... Christopher William Wesley wrote: > $myPairs = explode( "/", $PATH_INFO ); > while( list( $key, $val ) = each( $myPairs ) ){ > if( !empty( $val ) ){ > $my

Re: [PHP] URL Parsing Help

2002-01-29 Thread Christopher William Wesley
$myPairs = explode( "/", $PATH_INFO ); while( list( $key, $val ) = each( $myPairs ) ){ if( !empty( $val ) ){ $myVar = explode( "=", $val ); ${$myVar[0]} = $myVar[1]; } } For you example URI, "index.php/option=contact/step=view" you would then have $

Re: [PHP] URL parsing

2001-03-25 Thread Jaxon
whups, sorry - here is the example: I want to turn URI's like: /script.php/main/index.html?junk=junk /script.php/main/index.html// /script.php/main/index.html?? all into: /script.php/main/index.html best regards, jaxon On 3/25/01 9:25 PM, "Aaron Tuller" <[EMAIL PROTECTED]> wrote: > why can'

Re: [PHP] URL parsing

2001-03-25 Thread Aaron Tuller
why can't you str_replace the $QUERY_STRING frm the $REQUEST_URI? give an example of what you are trying to do? (I'm sorry if you did and I missed it) -aaron At 9:06 PM -0500 3/25/01, Jaxon wrote: >K, read em all, and understood more than I thought I :) > > >I still don't see how you can 'san

Re: [PHP] URL parsing

2001-03-25 Thread Jaxon
K, read em all, and understood more than I thought I :) I still don't see how you can 'sanitize' a URI, eg discard anything including and after "//" or "??". I think this is needed if you want to discard a query string or irregular syntax from your URI. ereg's don't work reliably, due to the p

Re: [PHP] URL parsing

2001-03-25 Thread Philip Olson
Hi! Check out these two related articles (and user comments) : Building Dynamic Pages With Search Engines in Mind : * http://phpbuilder.com/columns/tim19990117.php3 * http://phpbuilder.com/columns/tim2526.php3 Also c

Re: [PHP] URL parsing

2001-03-25 Thread Jaxon
oops :) http://www.domain.com/index.php/main/index.html?ii=1 versus http://www.domain.com/index.php/main/index.html I want to get "index.html" and "main" into variables, as the two items will always be present - if $ii is set, I want to strip it from the URI before parsing the items out. I supp

Re: [PHP] URL parsing

2001-03-25 Thread CC Zona
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Jaxon) wrote: > Any way to combine both forms of url parsing? > I want to use standard slash notation for navigation ,but also account for > the occasional variable used within a single page. > > e.g. URL can be either: > domain.com/index.php/m

Re: [PHP] URL parsing

2001-03-25 Thread Jaxon
Any way to combine both forms of url parsing? I want to use standard slash notation for navigation ,but also account for the occasional variable used within a single page. e.g. URL can be either: domain.com/index.php/main/index.html?ii=1 or: domain.com/index.php/main/index.html?ii=1 if (isset(

Re: [PHP] URL parsing

2001-03-23 Thread Jaxon
Oh wait, just do this in my page : URL -> index.php/main/1/pagename.html $path_array = explode('/', $REQUEST_URI); $tpl = $path_array[0]; $ii = $path_array[1]; $pagename = $path_array[2]; that works - sorry for being obtuse. regards, jaxon On 3/23/01 9:30 PM, "Jaxon" <[

Re: [PHP] URL parsing

2001-03-23 Thread Jaxon
Well assuming that this: index.php/tpl/main/ii/1/pagename/name.html is representative of this: index.php?tpl=main&ii=1$pagename=name.html then: $path_array = explode('/', $REQUEST_URI); $numPathElements = count($path_array); gives me: $path_array[0] = tpl $path_array[1] = mai

Re: [PHP] URL parsing

2001-03-23 Thread Aaron Tuller
super easy. $path_array = explode('/', $REQUEST_URI); $numPathElements = count($path_array); then loop through the elements and do what you need, you might need to use strtok() if you're expecting slashes in your arguments. -aaron At 8:58 PM -0500 3/23/01, Jaxon wrote: >how about parsing a ur

Re: [PHP] URL parsing

2001-03-23 Thread Jaxon
how about parsing a url from passing variables like : test.php/op/3/op2/6/pagename.html cannot this be parsed, to let search engines spider past the "?" properly? regards, jaxon On 3/23/01 7:46 PM, "Richard Lynch" <[EMAIL PROTECTED]> wrote: > I think you can change the separator in php.ini, a

Re: [PHP] URL parsing

2001-03-23 Thread Richard Lynch
I think you can change the separator in php.ini, and for sure you could do it by hand using $PATH_INFO or something. Personally, my first question would be if the new "standard" is actually being used or supported by anybody else... -- Visit the Zend Store at http://www.zend.com/store/ Wanna hel