473,405 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Compare lists

1
I'm trying to grab a list of items from a web page every day and look for changes since the day before. I should be able to work through grabbing the HTML each day, parsing out the list of items and then saving to a text file. However, I don't know how to approach the problem of comparing today's text file with yesterday's and determining which items that have been added or deleted.

Any hints to get me started would be greatly appreciated. Thanks.
Aug 23 '08 #1
1 1228
pbmods
5,821 Expert 4TB
Heya, nnd6a.

You have a couple of options:
  • If the server is configured to support caching properly, you can check the last-modified header sent with the document.
  • Alternatively, you can hash the contents and see if the signature matches what you already have on file. E.g.,:

    Expand|Select|Wrap|Line Numbers
    1. $html = loadWebPage($url);
    2. if( sha1($html) != $yesterdaysSha1Hash )
    3. {
    4.   processHTML($html);
    5.   $yesterdaysSha1Hash = sha1($html);
    6. }
Aug 23 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Fazer | last post by:
Hello, I was wondering which would be the best way to compare a list? I was thinking of just using a for loop and testing the condition. What do you guys think? The best/fastest way of...
6
by: Robin Siebler | last post by:
I have two directory trees that I want to compare and I'm trying to figure out what the best way of doing this would be. I am using walk to get a list of all of the files in each directory. I...
4
by: Gaby | last post by:
Hi all, What is the best way to compare 2 (large) ArrayLists filled with an object. Can you please help me? Gaby
3
by: Frank Esser | last post by:
Hi, if there are two objects of type "SortedList", how can I compare them? I want to find out whether they have exactly the same values and keys in the same sort order but I do not want to loop...
4
by: Justin Emlay | last post by:
I have two lists. These can be in either table form or array. That is, my data is in a dataset which I can move to an array if need be. ListA is a master list and it contains all items. ListB...
1
by: Ron | last post by:
Hi, I need to prefome a sync process on two Lists Lets say i have two Lists of type string. And each list can be dimensioned differently, but will eventually contain the same amount of elements...
4
cassbiz
by: cassbiz | last post by:
What I would like to do is run two queries with a single output. for example my first query is: <? $query = "(SELECT spacenummer FROM res WHERE arrival BETWEEN '$var_from' AND '$var_to' OR...
6
by: jairodsl | last post by:
Hello everybody ! I have two list, they are, S1=, and S2=, but i have to compare both in this way: A vs J A vs I, B vs J A vs H, B vs I, C vs J A vs G, B vs H, C vs I, D vs J
0
gits
by: gits | last post by:
This little article will show you how to optimize runtime performance when you need to compare two arrays (a quite common task). Have a close look at the entire article, and you will see the...
5
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I have a Container that is an an Array List of Class Each ArrayList element can be the class or a another ArrayList of Class So there the ArrayList could look like Element 1 - Class...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.