1

I am trying to make a Android application which will take your URL and if there is new update on that website then it will show the user that this link have been updated.

I am working on the project which will check for the website if they have been updated or not. I know that there are RSS on most of websites, but I am talking about those websites which don't have but are important for us. Like the websites where result will be posted but for that I will have to check that website again and again.

How can I check that website is updated or not?

1
  • 1
    Have you looked at If-Modified-Since header and the 304 response?
    – user40980
    Sep 25, 2014 at 5:47

3 Answers 3

1

You can use the If-Modified-Since HTTP header. If the server tells you that the page has been modified since the given date, then you can download the new content.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29

0

You could have your app calculate a hash of whatever the response from the website is, store it, then periodically check the website and compare a rehash of its response to your stored response. If they're different, then the website changed. If they're not, then there's a small chance they changed and managed to keep the same hash, but most likely the website is the same. That seems to me to be the only truly general solution. Using specific solutions for sub-cases (like websites with RSS) would be a better first-attempt, then you could use the hashing strategy as a fallback.

1
  • 1
    This is a solution that I have been using myself, but take into account that if there are ads on the page you might get different result each time.
    – Mads
    Sep 26, 2014 at 1:01
0

Reinventing the wheel, huh? I personally let https://www.changedetection.com/ send me an email & leave it to them to figure out if the page has changed. Perhaps your app could just scan your in-box for such emails? Or maybe a similar site has an API for developers?

There is some good info on WIkipedia. See also "5 Free Tools To Notify You of Website Content Changes".


If I had to code it from scratch, I would get the web page and generate an MD5 checksum. Fetch the page at regular intervals, regenerate the checksum and compare with the one stored in your database (of course,t eat will be triggered by a single character change, but you didn't specify what you consider to be a change - always nail down the requirements before getting into implementation).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.