Remove domain: What do think of this approach?

From: Date: Wed, 16 May 2007 08:22:26 +0000
Subject: Remove domain: What do think of this approach?
Groups: php.general 
Request: Send a blank email to php-general+get-255006@lists.php.net to get a copy of this message
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? Thanks! Cheers, Micky -- Wishlists: <http://snipurl.com/1gqpj> Switch: <http://browsehappy.com/> BCC?: <http://snipurl.com/w6f8> My: <http://del.icio.us/mhulse>

« previous php.general (#255006) next »