Page 1 of 1
Checking if I downloaded a full CSV file
Posted: Sun Dec 16, 2007 3:06 am
by nutkenz
I want to check if I downloaded a CSV file completely using PHP. If it were XML I could check if for the closing root element, but I'm not sure how to do this with CSV files... Does anyone have a clue?
Posted: Sun Dec 16, 2007 8:04 am
by feyd
If the last line is complete, that is enough. However there is no information included in the file that would state how many records there are. Your only help is from the server you fetch it from. The server is supposed to return a header stating how large the file is.
Posted: Sun Dec 16, 2007 11:45 am
by nutkenz
These are the only headers I'm getting:
Array
(
[0] => HTTP/1.1 200 OK
[1] => Date: Sun, 16 Dec 2007 17:42:36 GMT
[2] => Server: Apache
[3] => Connection: close
[4] => Content-Type: text/plain; charset=UTF-8
)