I want to detect the url my .php lies in.
This is over kill and BS:
$myurlvar = "http://".$SERVER_NAME.parse($SCRIPT_NAME);
How do I get "http://foo.com/dir1/dir2/dir3/";.
There seems to be nothing in phpinfo() that will give me a full url to
play with.
Flame me if you will, but I browsed TFM
be a function that does all this, however, you can try to work
around it
Thanks,
Ray Hunter
-Original Message-
From: jtjohnston [mailto:[EMAIL PROTECTED]]
Sent: Saturday, May 25, 2002 11:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP] inspirational
I want to detect the url my .php li
try:
$url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$, '\\1$SERVER_NAME\\2',
$SCRIPT_URI);
Michael
"Jtjohnston" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I want to detect the url my .php lies in.
>
> This is over kill and BS:
>
> $myurlvar = "http:
typo:
$url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$/', '\\1$SERVER_NAME\\2',
$SCRIPT_URI);
Michael
"Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> try:
>
> $url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$, '\\1$SERVER_NAME\\2',
> $S
but the scriptname itself will be included there.
Try this, if you don't want the scriptname to be included.:
$url = preg_replace('/^(http:\/\/)[^\/]+((\/[^\/])*\/)([^\/]+)$/',
'\\1$SERVER_NAME\\2', $SCRIPT_URI);
Haven't tested them, but should work.
Michael
"Michael Virnstein" <[EMAIL PROTECT
t;?
Try this:
$myurlvar = http:// . $SERVER_NAME . dirname($SCRIPT_NAME);
---John Holmes...
> -Original Message-
> From: jtjohnston [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, May 26, 2002 1:39 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] inspirational
>
> I want to det
6 matches
Mail list logo