andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


checking for updates

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> WWW Checkup
View previous topic :: View next topic  
Author Message
(jp)
Newbie


Joined: 03 Feb 2004
Posts: 4

PostPosted: Tue Feb 03, 2004 10:23 am    Post subject: checking for updates Reply with quote

I am running php >= 4.2, redhat 9, apache 2. Whenever I run update, it doesn't seem to do anything.. it just spools and eventually dumps a page without actually checking the websites. The page has the closing body and html tags, so I know the script is finishing, but just isn't updating anything.

This is what I'm running to update the db.
PHP:
<?
  
include "class.wwwcheckup.php";
  
$cu = new WebsiteCheckup("dbuser","dbpass","websites","monitor","localhost");
  
$cu->SetAutoUpdate(1);
  
$cu->DisplayUpdates();
?>


Thanks for the help.
Back to top
View user's profile Send private message
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Tue Feb 03, 2004 3:36 pm    Post subject: Re: checking for updates Reply with quote

Hi jp, and welcome to the board!

Instead of using 'SetAutoUpdate(1)', use 'SetAutoUpdate(true)', so that your script will look like:

PHP:
<?
  
include "class.wwwcheckup.php";
  
$cu = new WebsiteCheckup("dbuser","dbpass","websites","monitor","localhost");
  
$cu->SetAutoUpdate(true);
  
$cu->DisplayUpdates();
?>


See if that works out for ya.

Regards,

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
(jp)
Newbie


Joined: 03 Feb 2004
Posts: 4

PostPosted: Tue Feb 03, 2004 3:48 pm    Post subject: Reply with quote

That seemed to work (better). I actually show now in the db where it checked for updates. Strange thing is after a long time (waiting for update check to finish) it outputs, for example:

Code:
website   last checked   last updated
http://foxnews.com   yesterday at 10:13am   yesterday at 10:13am
http://usatoday.com   today at 10:01am   today at 10:01am


It does this for a handful of sites, even though the update was run, say at 3:12pm. I'm not sure what went wrong. Is there a way to turn on verbose or debugging to get more info?

Thanks.
Back to top
View user's profile Send private message
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Tue Feb 03, 2004 4:02 pm    Post subject: Reply with quote

As such there is no debugging in the class. I started to work that into all my recent classes, but just haven't gone back to my older ones for that - I really should. So basically you're left up to your own devises when it comes to debugging right now - sorry!

The delay comes probably because the script couldn't connect to the website, or the site was taking a long time to respond ('the site' being the one the script was trying to connect to at that time). This is because I use the 'file' function, which doesn't come with a built in timeout. I should probably move into doing direct http connection. That way at least a timeout could be set for sites that would otherwise delay the script.

Now, the odd times.. Hmm... Was the database empty when you started, or had you been playing with this script for a bit? Possibly something happened when creating the date (using mktime) and saving it into mysql as the date/time field. I don't think the fuzzytime function is malfunctioning. I'll check into it a bit tomorrow...

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
(jp)
Newbie


Joined: 03 Feb 2004
Posts: 4

PostPosted: Tue Feb 03, 2004 4:15 pm    Post subject: Reply with quote

I'll take a look at the code closer tonight to interject some debugging info. Maybe I can switch it over to use 'fsockopen'.

Thanks for the help!
Back to top
View user's profile Send private message
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Wed Feb 04, 2004 11:20 am    Post subject: Reply with quote

In response to this thread I've started to rework the class. I'm going to do a full update and add extra functionality. This means the class won't act exactly as it does now, but should be better anyway. For example, not only will you be able to check that a site has changed, you'll also be able to get a list of headers from a server.

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
(jp)
Newbie


Joined: 03 Feb 2004
Posts: 4

PostPosted: Wed Feb 04, 2004 11:23 am    Post subject: Reply with quote

Great! Thanks!

Let me know when it's ready for testing. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> WWW Checkup All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group