Read Server Path using PHP

This article shows you how to read server URL using PHP.
As an example if this code runs at abc.com/index.php then it output abc.com

Source coed added below.

$pos = strripos($_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], '/');
$serverFTPPath = substr($_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"],0,$pos);

Happy coding.

Comments

Popular Posts