0

my project has me needing to read a csv file and display in a browser automatically. Before I post the code, I want to confirm I have the logic correct and not be confusing myself with more development then necessary. From my research there is 2 ways this can be done at a bare basic level.

Cross domain: A program (R) on server 1 has outputted a csv file on some set time interval. I then need to use a server side language (php) on server 1 to parse the data and put into an array. I then use a php proxy or JSONP format on server 2 for a cross domain GET to call it via AJAX and load into the client side script on server 2.

Same domain: A program (R) on the server has outputted a csv file on some set time interval. I would still need to use a php script to parse the data and put data into an array, which then I do an AJAX call to load the data into the client side script in JS.

I cannot use jquery-csv plugin and HTML5 FileReader to do so automatically in either case because that is for a client user manually uploading a file?

Also, to have a 2 way connection whereby data is push and pull I need to implement websockets or long polling/HTTP streaming.

Please confirm my logic above.

Thanks.

3
  • I do not understand what you need to do. Can you use PHP on both machines? Commented Oct 18, 2013 at 9:03
  • @sebastien. Yes I can. Allow me to clarify further, I am wondering what is the most efficient way to display a csv file that is generated by a model and display that to end users. Users can only view the data, there is no interaction with it. Commented Oct 18, 2013 at 9:52
  • I would go with @DmitriyMozgovoy's answer. Commented Oct 18, 2013 at 10:04

1 Answer 1

1

You need to parse CSV on the first server and send parsed data to server 1 (or download to server 1 from server 2)? If so, you just need fgetcsv on server 1 and simple curl/file_read_contents on server 2.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.