4 * This file generates sample csv fil for testing large imports.
5 * Run following command: php csv_gen.php
6 * It will generate contacts.csv file with $totalRows contacts
8 $data = "First Name, Last Name, Email, Street Address 1, Street Address 2, Phone, IM \r\n";
12 while ($count <= $totalRows) {
13 $data .= "first{$count}, last{$count}, email{$count}@email.com, street1{$count}, street2{$count}, 9888909{$count}, im{$count} \r\n";
17 $filename = 'contacts.csv';
19 if (!$handle = fopen($filename, 'w')) {
20 echo "Cannot open file ($filename)";
24 if (fwrite($handle, $data) === FALSE) {
25 echo "Cannot write to file ($filename)";
29 echo "Successfully created csv for $totalRows contacts and wrote to file ($filename)\n\r";