Opening remote file using PHP
-
17-06-2021 - |
Pergunta
I have a PHP page where i want to open a file on a remote machine and read its contents. I have to specify the remote machine's IP address. How can this be done in PHP ?
Solução
echo file_get_contents("http://1.1.1.1/file.txt")
Outras dicas
You can read the contents of any file with file_get_contents()
.
You don't need to specify the ip of the remote machine. You can just use
file_get_contents('http path to file');
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow