Why does PHP not support relative URLs?
Can this be done with other programming languages? That the the server side can micro quick detect?
$urla="http://cdn.domain.net";
$urlb="//cdn.domain.net";
if(@fopen($urla,"r")){
// I work
}
if(@fopen($urlb,"r")){
// I do not work
}
Now that I mention it, much of the prime PHP cannot work like this or does not support as I am guessing due to server side – perhaps modification of CORE PHP is need in the C libraries? (What is a Relative URL?)
Relative URL support needs a Base URL the relative URL is relative to. Please see 4.2. Relative Reference in RFC 3986 URI Generic Syntax.
Taken that into account, there is a PHP Library available that actually does support relative URLs and it is compatible with
fopen. It’s calledNet_URL2:See as well problem with adding root path using php domdocument.