Reply to Re: PHP URI

Your name:

Reply:


Posted by Justin Koivisto on 12/27/05 20:28

Trevor wrote:
> How can I get the URI for a page? For example, I want $domain =
> "http://www.domain.com" in the page http://www.domain.com/page.php.

That will depend on a bunch of different things, mostly to do with your
server setup...

Here's something to get you started (in apache):
$urI = $_SERVER['REQUEST_URI']; // includes query string...
$proto=substr($_SERVER['SERVER_PROTOCOL'],0,strpos('/',$_SERVER['SERVER_PROTOCOL']));
$port=$_SERVER['SERVER_PORT'];
$host=$_SERVER['HTTP_HOST'];
$urL = strtolower($proto).'://'.$host.':'.$port.$urI;

When in doubt, check the output of phpinfo()

--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация