PHP Application - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Programming
Click Here to Login
Closed Thread
 
Thread Tools Display Modes
 
Old 08-18-2003, 11:34 PM   #1 (permalink)
True Techie
 
Join Date: Jul 2003
Posts: 134
Send a message via AIM to tavilach
Default PHP Application

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
tavilach is offline  
Old 08-18-2003, 11:54 PM   #2 (permalink)
True Techie
 
Join Date: Jul 2003
Posts: 134
Send a message via AIM to tavilach
Default

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
tavilach is offline  
Old 08-18-2003, 11:57 PM   #3 (permalink)
Master Techie
 
Join Date: May 2003
Posts: 2,470
Default php file compare...

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);
}
Larry is offline  
Old 08-22-2003, 12:49 AM   #4 (permalink)
Newb Techie
 
Join Date: Aug 2003
Posts: 11
Send a message via AIM to SDesigns Send a message via Yahoo to SDesigns
Default

Reading character for character looking for differences will put some load on the server... and it will end up being VERY slow if your file is of reasonable size...
SDesigns is offline  
Old 08-22-2003, 01:08 AM   #5 (permalink)
Newb Techie
 
Join Date: Aug 2003
Posts: 8
Default

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.
casino is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 02:57 AM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.