I have a problem. I'm downloading csv file with url and using curl library, but problem is that, this csv file is not right, so I need to change semicolon (;) on comma (,).
if ($fileHandle) {
$url = $this->csvUrl;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_FILE, $fileHandle);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$string = fopen($localPath, 'r');
$data = stream_get_contents($string, -1, 30);
$data = str_replace(';', ',', $data);
curl_exec(???);
curl_close(???);
chmod($localPath, 0755);
return $localPath;
}
I want to write changed content on this path.