Checking if I downloaded a full CSV file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nutkenz
Forum Contributor
Posts: 155
Joined: Tue Jul 19, 2005 12:25 pm

Checking if I downloaded a full CSV file

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
nutkenz
Forum Contributor
Posts: 155
Joined: Tue Jul 19, 2005 12:25 pm

Post 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
)
Post Reply