Re: [PHP] Remove domain: What do think of this approach?

2007-05-16 Thread Micky Hulse

Micky Hulse wrote:

/*
** Output:
** /web1/httpd/htdocs/blogs/images/uploads
*/


Ooops, typed that wrong, example output should be:

/web1/httpd/htdocs/folder/foo

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Remove domain: What do think of this approach?

2007-05-16 Thread Robin Vickery

On 16/05/07, Micky Hulse [EMAIL PROTECTED] wrote:

Hi folks, I hope everyone is having a good week. :)

Let me cut to the chase... Basically, I need to get this:

http://www.site.com/folder/foo

To work like this:

$_SERVER['DOCUMENT_ROOT'].'folder/foo/file.ext';

For use with getimagesize() and a few other functions (trying to avoid
possible open_basedir restrictions.) Here is what I got so far:

# Determine http type:
$http_s = ($_SERVER['HTTPS'] == on) ? 'https://' : 'http://';
# Get root path:
$from_root = str_replace($http_s.$_SERVER['SERVER_NAME'], '',
http://www.site.com/folder/foo);
echo
$_SERVER['DOCUMENT_ROOT'].$from_root;
/*
** Output:
** /web1/httpd/htdocs/blogs/images/uploads
*/

So, do you think I can rely upon the above script? I have a feeling the
answer will be no Or, anyone have any tips/improvements?


use parse_url()

http://www.php.net/parse_url

then append the 'path' part to document root ?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Remove domain: What do think of this approach?

2007-05-16 Thread Micky Hulse

Robin Vickery wrote:

use parse_url()
http://www.php.net/parse_url
then append the 'path' part to document root ?


OMG, that looks like it will do the trick!

Jeez, how did I miss that. I feel like a dufus.

Are list members allowed at least one RTFM question per month? :D

Thanks Robin! I appreciate the help.

Have a great day/night.
Cheers,
Micky



--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php