문제

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 ?

도움이 되었습니까?

해결책

echo file_get_contents("http://1.1.1.1/file.txt")

다른 팁

You can read the contents of any file with file_get_contents().

Docs: http://php.net/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');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top