1,105,556 Community Members

Copying a Csv file from web page to database

Member Avatar
rahulroshan
Light Poster
28 posts since Aug 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
thines01
Postaholic
2,420 posts since Oct 2009
Reputation Points: 389 [?]
Q&As Helped to Solve: 413 [?]
Skill Endorsements: 10 [?]
Team Colleague
Featured
 
0
 

Do you program?

Member Avatar
rahulroshan
Light Poster
28 posts since Aug 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Yes , I know basics of Php,sql and python

Member Avatar
thines01
Postaholic
2,420 posts since Oct 2009
Reputation Points: 389 [?]
Q&As Helped to Solve: 413 [?]
Skill Endorsements: 10 [?]
Team Colleague
Featured
 
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

Question Answered as of 2 Years Ago by thines01
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article