This is odd, but for some reason the $_SERVER[\"SCRIPT_URI\"] will not return the domain name when I am in child/sub-pages but will only work on the main page.
If your browser formats JSON documents nicely and no output has taken place, inserting the following will result in something more readable than var_dump: