Page 1 of 1

[SOLVED] Using php to get contents of web page

Posted: Tue Jul 10, 2007 10:51 pm
by mcccy005
Alrighty, basically what I want to do is find out the IP Address of my web server because it changes frequently. I only have the web server set up for testing purposes which is why I'm not paying for a static IP Address at this stage.

If I user the built-in php $_SERVER variables, none of them actually provide me with the IP address of my computer. So what I want to do is schedule a php file to run which will open up a page (http://jackson.io/ip/) which prints out only the IP address of the server (or actually, the router in my network).
I then want to read the contents of this web page; check it against a file which has my IP address stored in it; and if the two IP addresses are different (ie. mine has changed), then I want to send an email to the people testing the website notifying them of my new IP Address.

So...how can I actually read the contents of the particular web page retrieved from the above URL?
(PS. credit for the services of the above web page go to: http://jackson.io/ip/service.html).

Posted: Tue Jul 10, 2007 11:39 pm
by afbase
try curl()

Posted: Wed Jul 11, 2007 1:17 am
by toasty2
Have you ever heard of Dynamic DNS? Just get a free hostname to be updated to your IP with a update client.

Posted: Wed Jul 11, 2007 7:58 pm
by mcccy005
Funnily enough I read something on the website I mentioned in the opening post about that but didn't pay much attention to it...I kind of read over it straight to the bit I was interested in with regard to getting my IP Address of my hosting server!

But thanks for the info; I did end up going to no-ip.com and signed up with them (as they were free and provided me with some software to run on my web server which would automatically update the changing IP on the dynamic domain name server).