I am using a cURL request for downloading a CSV file from an FTP server.
I have downloaded my file in my webroot folder (in my given path).
But when I am trying to read the CSV data from the file it isn’t showing anything.
$leadDir is path of my downloaded file.
if ($fp = fopen($leadDir, "r")) {
echo $fp;
echo "come after fopen";
while ($CSVData = fgetcsv($fp)) {
echo "</br>";
echo "come after fgetcsv";
}
}
It is not going inside the while loop.
I have also checked the file permissions, I have given it 777 permissions.
Where is it going wrong?
the code should be ok, so my best answer is that the path is incorrect, try something like