954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Copying a Csv file from web page to database

Hi I have a Csv file in website and it gets updated every half an hour, I want to copy the csv file to database(Mysql)to visualize it can anyone help.
thnx

rahulroshan
Light Poster
27 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

Do you program?

thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

Yes , I know basics of Php,sql and python

rahulroshan
Light Poster
27 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

Well, you might know that you can open a file on a web server in PHP with fopen

$fileInFile=fopen("http://www.fas.usda.gov/psdonline/download/support_tables/countries.csv", "rb");
   while(!feof($fileInFile))
   {
      $strData = fgets($fileInFile);
      printf($strData);
   }
   fclose($fileInFile);


...then parse the contents and insert into the database

thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You