<?php
//define variable of csv file
$csv = array();
$lines = file(‘https://www.idelonghi.com.hk/pub/media/Zh.csv’, FILE_IGNORE_NEW_LINES);
foreach ($lines as $key => $value)
{
$csv[$key] = str_getcsv($value);
}
// count the number of $csv.
$number = count($csv);
// define variable
$delonghi = array();
for ($x = 0 ;$x <= $number-1;$x++)
{
if(strpos($csv[$x][3], ‘De\’Longhi’ ) !== false)
{ //check idelonghi
//push the colum to file
array_push($delonghi,$csv[$x]);
}
}
header(‘Content-type: application/csv’);
// Set the file name option to a filename of your choice.
header(‘Content-Disposition: attachment; filename=Delonghi.csv’);
// Set the encoding
header(“Content-Transfer-Encoding: UTF-8”);
$fp1 = fopen(“php://output”,”a”);
foreach ($delonghi as $fieldss){
fputcsv($fp1, $fieldss);
}
fclose($fp1);
?>