Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8693797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:37:34+00:00 2026-06-13T00:37:34+00:00

i want wo write a small php program which which fetches a csv file

  • 0

i want wo write a small php program which which fetches a csv file from a remote server via cURL. It works so far and now I want to use this csv file in JS.

What is the best way to give this file from php to JS?

Create tmp file on php server and use a link to this file in JS? Is there a smarter way?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:37:35+00:00Added an answer on June 13, 2026 at 12:37 am

    I would use AJAX to call the PHP file, which will then use cURL to get the CSV.

    If you choose to load the file in the DOM directly with PHP, the page will not appear until the cURL operation has completed. From experience, I noticed that if a page takes 30 seconds to load, it’s better to show the page with a “loading…” than displaying a blank page for 29 seconds and show everything in the last second.

    By the way, using cURL and calling with AJAX is also a way to circumvent Same-domain AJAX.

    I wouldn’t suggest to use PHP code in the JS, as it would remove the possibility to cache/minify the JS efficiently, if you choose to do so down the road. Also, it’s not pretty.

    How I would do it;

    • Call the PHP file using AJAX
    • Get the file using cURL
    • Output its data in JSON, its probably going to look like this

      “{“1”:{“col1″:”hey”,”col2″:”hey2″},”2″:{“col1″:”heyhey”,”col2″:”heyhey2″}}”

    • Display data in a table, probably using dataTables or something equivalent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small problem, I want to load data from a PHP file
I want to write a small bit of data from my app to the
I want write a simple query which will fetch data from a table (which
I want to write a small management tool to oversee my server processes, my
i want a write a php script which can start , stop , enable
I am learning php. I want to write string to file, but nothing happens.
I want to write a small program that should print something like testing CPU...
Let's say I want to write a small program that we can give it
I want to write a small Android app with a GUI that should display
HI, I want to write a small Delphi IDE Expert for D2007-D2009 (aka. Galileo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.