Re: [PHP] String Parse Help for novice

2010-06-14 Thread Robert Cummings
tedd wrote: At 9:29 PM -0400 6/13/10, Robert Cummings wrote: $parsed['pathbits'] = explode( '/', ltrim( dirname( $parsed['path'] ), '/' ) ); return $parsed; } $url = my_parse_url( 'http://foo.fee.com/blah/bleh/bluh/meh.php' ); print_r( $url ); ?> Cheers, Rob. Rob: Very neat. It

Re: [PHP] String Parse Help for novice

2010-06-14 Thread tedd
At 9:29 PM -0400 6/13/10, Robert Cummings wrote: $parsed['pathbits'] = explode( '/', ltrim( dirname( $parsed['path'] ), '/' ) ); return $parsed; } $url = my_parse_url( 'http://foo.fee.com/blah/bleh/bluh/meh.php' ); print_r( $url ); ?> Cheers, Rob. Rob: Very neat. It also handle

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Adam Richardson
On Sun, Jun 13, 2010 at 9:29 PM, Robert Cummings wrote: > Rick Dwyer wrote: > >> Hello List. >> >> I need to parse the PATH portion of URL. I have assigned the path >> portion to a variable using the following: >> >> $thepath = parse_url($url); >> >> >> Now I need to break each portion of the pa

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Robert Cummings
Rick Dwyer wrote: Hello List. I need to parse the PATH portion of URL. I have assigned the path portion to a variable using the following: $thepath = parse_url($url); Now I need to break each portion of the path down into its own variable. The problem is, the path can vary considerably

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Ashley Sheridan
On Sun, 2010-06-13 at 18:52 -0400, Rick Dwyer wrote: > OK, sorry for any confusion. > > Here is all my code: > > $url = "http" . ((!empty($_SERVER['HTTPS'])) ? "s" : "") . "://". > $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; > $thepath = parse_url($url); > > So, given that the URL can var

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Rick Dwyer
OK, sorry for any confusion. Here is all my code: $url = "http" . ((!empty($_SERVER['HTTPS'])) ? "s" : "") . "://". $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; $thepath = parse_url($url); So, given that the URL can vary as follows: /mydirectory/mysubdirectory/anothersubdirectory/mypage.

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers
On Jun 13, 2010, at 5:40 PM, Ashley Sheridan wrote: On Sun, 2010-06-13 at 17:35 -0500, Karl DeSaulniers wrote: On Jun 13, 2010, at 5:31 PM, Ashley Sheridan wrote: > On Sun, 2010-06-13 at 17:27 -0500, Karl DeSaulniers wrote: > >> On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote: >> >>> On S

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Ashley Sheridan
On Sun, 2010-06-13 at 18:35 -0400, Rick Dwyer wrote: > OK, I get the following error: > > Warning: basename() expects parameter 1 to be string, array given in > > When I use the following: > > $thepath = parse_url($url); > $filename = basename($thepath); > > Is my variable thepath not auto

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers
On Jun 13, 2010, at 5:35 PM, Rick Dwyer wrote: OK, I get the following error: Warning: basename() expects parameter 1 to be string, array given in When I use the following: $thepath = parse_url($url); $filename = basename($thepath); Is my variable thepath not automatically string?

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Ashley Sheridan
On Sun, 2010-06-13 at 17:35 -0500, Karl DeSaulniers wrote: > On Jun 13, 2010, at 5:31 PM, Ashley Sheridan wrote: > > > On Sun, 2010-06-13 at 17:27 -0500, Karl DeSaulniers wrote: > > > >> On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote: > >> > >>> On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer w

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers
On Jun 13, 2010, at 5:35 PM, Rick Dwyer wrote: OK, I get the following error: Warning: basename() expects parameter 1 to be string, array given in When I use the following: $thepath = parse_url($url); $filename = basename($thepath); Is my variable thepath not automatically string?

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Rick Dwyer
OK, I get the following error: Warning: basename() expects parameter 1 to be string, array given in When I use the following: $thepath = parse_url($url); $filename = basename($thepath); Is my variable thepath not automatically string? --Rick On Jun 13, 2010, at 6:23 PM, Ashley Sheridan

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers
On Jun 13, 2010, at 5:31 PM, Ashley Sheridan wrote: On Sun, 2010-06-13 at 17:27 -0500, Karl DeSaulniers wrote: On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote: On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer wrote: Hello List. I need to parse the PATH portion of URL. I have assigned th

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Ashley Sheridan
On Sun, 2010-06-13 at 17:27 -0500, Karl DeSaulniers wrote: > On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote: > > > On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer wrote: > > > >> Hello List. > >> > >> I need to parse the PATH portion of URL. I have assigned the path > >> portion to a variable

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers
On Jun 13, 2010, at 5:23 PM, Ashley Sheridan wrote: On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer wrote: Hello List. I need to parse the PATH portion of URL. I have assigned the path portion to a variable using the following: $thepath = parse_url($url); Now I need to break each portion o

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Karl DeSaulniers
On Jun 13, 2010, at 5:13 PM, Rick Dwyer wrote: Hello List. I need to parse the PATH portion of URL. I have assigned the path portion to a variable using the following: $thepath = parse_url($url); Now I need to break each portion of the path down into its own variable. The problem is,

Re: [PHP] String Parse Help for novice

2010-06-13 Thread Ashley Sheridan
On Sun, 2010-06-13 at 18:13 -0400, Rick Dwyer wrote: > Hello List. > > I need to parse the PATH portion of URL. I have assigned the path > portion to a variable using the following: > > $thepath = parse_url($url); > > > Now I need to break each portion of the path down into its own > vari