Monitoring a URL on another server...

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
jeffrydell
Forum Commoner
Posts: 77
Joined: Thu Jan 17, 2008 4:39 pm
Location: Menasha, WI

Monitoring a URL on another server...

Post by jeffrydell »

I'd like to run a script that checks various URL's and alert me if a change has been made.

I would seem easy, I could use filemtime() or filesize() and compare that vs. info stored in my database for that specific URL. I guess either works great if comparing statistics for a static page ... but what can I do to get a value for comparison if it's a dynamic page? (Like http://Domain.com/page.cfm?id=12345)

Any way to compare? OR can I use my script to 'capture' the contents and "look" for a specific string within the page? If so - how?

Thanks in advance for whatever you can suggest!

Jeff
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Monitoring a URL on another server...

Post by jaoudestudios »

You can use file and treat the remote file as a live feed.

Then save it to a string and do a compare.
jeffrydell
Forum Commoner
Posts: 77
Joined: Thu Jan 17, 2008 4:39 pm
Location: Menasha, WI

Re: Monitoring a URL on another server...

Post by jeffrydell »

Got it - I can look for the string which indicates that page has what I want, then display the page IF in_array(). Perfect - thanks!

Jeff
Last edited by jeffrydell on Fri Aug 01, 2008 12:03 pm, edited 1 time in total.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Monitoring a URL on another server...

Post by jaoudestudios »

Sorry, I did not mean to make it more confusing for you.

Ignore the bit about the live feed. But lookup file function on php.net
jeffrydell
Forum Commoner
Posts: 77
Joined: Thu Jan 17, 2008 4:39 pm
Location: Menasha, WI

Re: Monitoring a URL on another server...

Post by jeffrydell »

I tinkered a bit, learned and have a successful fix ... thanks so much!

Jeff
Post Reply