I would like to retrieve some zipcode data from the API which responses as CSV file format. I can retrieve data from the API successfully and able to save the file in the server by using the following code, but it doesn't save as a proper CSV file in the server. Thus, when read the CSV file programmatically, it throws an error.
When I download the generated file from the server and open the file in excel, there is a warning message as attached in the screenshot, if press "Yes", I can read the data manually without any issue and refer the attached "pincode_data.csv" file that has been generated by the below code.
How to fix to save a file as CSV in the server? kindly help and advise.
Please refer my coding as below;