[SOLVED] Using php to get contents of web page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mcccy005
Forum Contributor
Posts: 123
Joined: Sun May 28, 2006 7:08 pm

[SOLVED] Using php to get contents of web page

Post 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).
Last edited by mcccy005 on Wed Jul 11, 2007 7:58 pm, edited 1 time in total.
afbase
Forum Contributor
Posts: 113
Joined: Tue Aug 15, 2006 1:29 pm
Location: SoCAL!!!!

Post by afbase »

try curl()
toasty2
Forum Contributor
Posts: 361
Joined: Wed Aug 03, 2005 10:28 am
Location: Arkansas, USA

Post by toasty2 »

Have you ever heard of Dynamic DNS? Just get a free hostname to be updated to your IP with a update client.
mcccy005
Forum Contributor
Posts: 123
Joined: Sun May 28, 2006 7:08 pm

Post 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).
Post Reply