Computers |
|
| | #1 (permalink) |
| True Techie | I just had a really cool idea for a PHP application, but I don't know how to do two things: 1) Compare two files for equality. 2) Saving a web page as a file (like what you do in IE, when you click "Save As...-->Web Archive"--it saves the current state of the page as a .mht file) using PHP. In other words, giving PHP a web address, and letting it save the state of that address. Any help will be most appreciated!
__________________ \"Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.\" -Archimedes |
| | |
| | #2 (permalink) |
| True Techie | Actually, using PHP to save the source code, instead of saving the .mht file, should also work...but, again, I don't know how to do that.
__________________ \"Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.\" -Archimedes |
| | |
| | #3 (permalink) |
| Administrator Join Date: May 2003
Posts: 1,397
| About comparing 2 files, you can open each file, read character for character and compare them. here is some code I have to read a file, I'm sure you can tweak it to fit your needs function FileCompare() { $file_data1 = fopen ("/path_to_file/file1.txt", "r"); $file_data2 = fopen ("/path_to_file/file2.txt", "r"); while (!feof ($file_data)) { $record = fgets($file_data); $ra = split( ',', $record); //open other file and read/compare the characters } fclose($file_data); } |
| | |
| | #5 (permalink) |
| Newb Techie Join Date: Aug 2003
Posts: 8
| yes and no... I have imported a flat file into a database over the web very quickly. The file size was about 4.5 meg and takes less than a minute or 2. This is reading line by line, though.. nonetheless, importing 25,000 records into a db from a flat file is pretty quick. This is even doing a little logic/editing the data before it is inserted. I was amazed at how fast it was. Not sure how much time it would add, reading character by character. |
| | |