Skip to content

Instantly share code, notes, and snippets.

@agborkowski
Created June 15, 2016 09:21
Show Gist options
  • Save agborkowski/8fbf390fda2ed5bbee6d2f58a0954d3a to your computer and use it in GitHub Desktop.
Save agborkowski/8fbf390fda2ed5bbee6d2f58a0954d3a to your computer and use it in GitHub Desktop.
$csv = file_get_contents($from);
$csvRows = preg_split('/[\r\n]{1,2}(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/', $csv); #split csvRows properly
$data = array();
//domain//group//url
echo "Start importing data {$from}";
$head = str_getcsv(array_shift($csvRows), ',');
print_r($head);
$created = date('Y-m-d');
$i = 0;
foreach ($csvRows as $row) {
$i++;
$column = str_getcsv($row, ',');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment