Suppose I have a php file "read_file.php" that is used to read .txt files, the structure of the folder/files are:


I was wondering which will be faster and why in PHP..

Method 1:
read file using relative path

Eg: get_file_contents("public/upload/test.txt");

Method 2:
read file using URL (note that the server which is making the request and the server where the file is being read is same)

Eg: get_file_contents("http://mydomain.com/public/upload/test.txt");

Can someone explain me which is faster and why?