Read link from text file


#1

my ip address changes every few months
so i want to make a text file that i can edit with the new ip address
the text file would only have the latest ip address and nothing else
for example xx.xx.xx.xx

then on the webpage it would read the text file and convert the ip address to a variable and add the different port numbers need to access the different ip cameras
something like this line
iframe name=“main” src="($ip)+:port number" height=“100%” width=“100%” frameborder=“0” scrolling=“no”>

can someone point me to what commands i should be using
or show me the code please


#2

http://php.net/file_get_contents

http://php.net/manual/en/function.echo.php


#3

Depending on your network setup and php configuration you could skip manually updating the IP address file and just do a file_get_contents() to https://www.ipify.org/ and json_decode() the result to an object and <?php echo $object->ip; ?>