This seems like a simple and general task, but we cannot get it to work:
We have two of us working on a project, and both of our machines are installed as local servers with a production environment.
At the beginning of our entire project, we have PHP. As below:
$feed = "/lib/php/backend/gateway.php?action=history";
$json = file_get_contents($feed, true);
The only way to make it work is to set it as the full URL, for example http://dev01.domain.com/lib/php/backend/gateway.php?action=history , or configure it as a local host this way
$feed = "http://localhost/lib/php/backend/gateway.php?action=history";
$json = file_get_contents($feed, true);
The latter, obviously, works on our local boxes and will presumably work in production, but is there a way to use relative paths to be a little cleaner?
source
share