Guest Posted April 14, 2004 Share Posted April 14, 2004 My client doesn't process orders in real time so once a day he exports customer info and credit card info to a space delimited text file for input into his credit card processing software. Here's my problem. I have the script written -- here's the gist of it $out_file = 'data/upsource.dat'; $fp = fopen( $out_file, 'w' ); $sth = some sql query while( $r = tep_db_fetch_array($sth) ) { // get data for the file $string = implode(" ", $final_output) . "\n"; #$string = implode(" ", $final_output) . "\r"; fputs( $fp, $string ); } fclose($fp); A file gets created no problem, but when my client goes to open this file in window's notepad, the end of line (EOL) is screwy. All it is is a small box...there is no EOL. As you can see, I've tried \r as an EOL char but that hasn't worked either. When I open the file in wordpad, they look just fine. Apparently my client's credit card processing software doesn't like either of the files I've given my client to feed it. Has anyone had this problem. Any help would be great. Link to comment Share on other sites More sharing options...
Guest Posted April 14, 2004 Share Posted April 14, 2004 I figured it out...again! OK, my client is using PC charge to process credit cards offline and apparently notepad is a good judge as to whether or not the processing of the credit cards will bork or not. So when appending a newline to the end of a line, it (notepad and PC charge) needs a carriage return (CR) and a line feed (LF) which is denoted as "\n" in php but notepad doesn't like just the "\n". You need BOTH a CR + (CR+LF) or a \r and a \n. Weird I know, here's what my code looks like. $string = implode(" ", $final_output) . "\r\n"; this seemed to work. hope this helps someone. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.