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

  • Home
  • SEARCH
  • 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 6202005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:39:17+00:00 2026-05-24T04:39:17+00:00

I am looking for some general guidance on this one… I have created a

  • 0

I am looking for some general guidance on this one…

I have created a PHP script that uses cURL to download a csv file. Currently, it downloads the file to my computer when I run the script. I would like to amend the download path to route it to a directory on my web host. Is there any easy way to do this with PHP?

Here is a quick summary of the PHP script that downloads the CSV file:

<?php 

$ch = curl_init(); 
//this is where I submit the form to download the csv file...
curl_close ($ch);  

header("Content-Disposition: attachment; filename=file_I_am_downloading.csv"); 
header("Content-Type: application/octet-stream"); 
readfile("http://www.example.com/file_I_am_downloading.csv");
?>

To sum this up, I would like the script to be amended so that when I run this PHP file it downloads ‘file_I_am_downloading.csv’ to a specific directory on my host rather than first downloading to my computer. Thank you for your time and any direction you can provide is much appreciated.

  • 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-05-24T04:39:18+00:00Added an answer on May 24, 2026 at 4:39 am
    $ch = curl_init();
    .... curl setup
    $data = curl_exec($ch);
    if ($data === FALSE) {
       die(curl_error($ch));
    }
    
    // do this, instead of the header/readfile business.
    file_put_contents('/some/path/on/your/webhost', $data);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m looking for some samples/tutorials/general pointers in doing either of the following. 1) Create
Looking for some direction here as I'm running into some migration problems. We have
Looking at some code I'm maintaining in System Verilog I see some signals that
I'm looking for some way to effectively hide inherited members. I have a library
I'm looking for some software that allows me to control a server based application,
I am hoping to receive some general guidance on accomplishing a seemingly simple goal.
I've been looking for some guidelines on how to layout PHP code. I've found
Action Helpers are recommended in general over extending Zend_Controller_Action . Looking at some of
I'm looking for some general advice on how to go about finding items 'like'
I am new to Android programming, and looking for some general knowledge. I am

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.