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 4626070
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:21:54+00:00 2026-05-22T03:21:54+00:00

I am creating an Excel file dynamically(data coming from database). on calling the URL

  • 0

I am creating an Excel file dynamically(data coming from database). on calling the URL it works fine it shows the download dialog box. but i want to save this file in a folder(i.e in my servers harddisk) dynamically whenever i call this URL using CURl function.
How can i set the headers in such a way that it will create the Excel file and save it in a folder.
The header code that i am using,

<?php
   $name = "myFile";
   $file_ending = "xls";
   header("Content-type: application/octet-stream");
   header("Content-Disposition: attachment; filename={$name}.{$file_ending}");
   header("Pragma: no-cache");
   header("Expires: 0"); 

   echo "the data...";
?> 

or is there any other method to do so.
NOTE-I want it this way because, this function will be called by the web servers scheduler.

  • 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-22T03:21:55+00:00Added an answer on May 22, 2026 at 3:21 am

    You cannot save something in some specific path by setting headers. HTTP headers specifically only help transport data across an HTTP network connection, which knows nothing of file systems.

    Perhaps you just want to write the data into a file instead?

    file_put_contents('file.xls', "the data...");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating windows application to insert data from Excel file into database. My
Basically I need to insert a bunch of data to an Excel file. Creating
An iPhone app which I am creating generates reports from a Core Data database
I am creating a copy of an Excel file using VBA. In the file,
I'm creating a xml-file for display in Excel using _di_IXMLDocument. But for some tags
Hi I am creating the application which creates the excel file pro grammatically. Now
I'm creating Excel files in a PHP project. Those files aren't just CSV data...
I'm creating an Excel file in C# on my asp.net web site. Then, I
I am creating an excel file output in c# using OWC11 components. The output
I am currently formatting a Date for a specific Excel file Export from a

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.