MURL

MURL is loaded by default.

Public Methods



protocol():String


As expected protocol returns a string representation of the protcol being used.

MURL::protocol(); 
string(4) "http"

subdomain():String


The subdomain function return a string of the subdomain of the page being requested. If no subdomain is preset it will return an empty string.

MURL::subdomain(); 
string(8) "mogulmvc"

domain():String


The domain function returns the domain of the site plus the top level domain.

MURL::domain(); 
string(12) "mogulmvc.com"

canonical():String


The canonical function returns the root location of the web site.

MURL::canonical(); 
string(19) "http://mogulmvc.com"

current():String


The current function returns the current url being viewed.

MURL::current(); 
string(36) "http://mogulmvc.com/php/library/murl"

segment($segment:int):String


The segment function returns parts of the URL devided along forward slashes. Just like arrays they are 0 based with the cannonical representing segment 0. However unlike arrays 0 is not a valid index.

Any segment requested but not in existence will return an empty string.

MURL::segment(1); 
string(3) "php"
MURL::segment(2); 
string(7) "library"
MURL::segment(3); 
string(4) "murl"
MURL::segment(4); 
string(0) ""

curl($url:String):Mixed


The curl function mimics the command line curl function avalible on *nix systems. It will download and return any remote page.