473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Loading all the data of a page into a variable.

Hi.

I was wondering how you would go about emulating

header('Content-Type: application/csv');
header('Content-Disposition: attachment; filename=' . 'test' . '.csv');
but instead of getting a file...I would like to load all the data into
a variable.
Is this possible?

Jul 17 '05 #1
2 1352
NC
bi*******@gmail.com wrote:

I was wondering how you would go about emulating

header('Content-Type: application/csv');
header('Content-Disposition: attachment; filename=test.csv');

but instead of getting a file...I would like to load all the data
into a variable. Is this possible?


Please clarify your question. Are you trying to generate a file
or retrieve one? In case you are retrieving, the problem is
solved very easily:

$data = file_get_contents('test.csv');

If you have allow_url_fopen enabled, this approach can be used
on remote files as well.

Cheers,
NC

Jul 17 '05 #2
You can also shove the file into an array with the file() function:
http://us3.php.net/file

so..

$file = file('test.csv');
foreach($file as $line=>$content) {
echo $content;
}

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rob Tweed | last post by:
I have a customer who is having problems when their Windows 2000/IIS/PHP-based system begins to experience a level of loading that isn't, in my view, unreasonably high. I'm wondering what others...
5
by: Louis Yactayo | last post by:
I store default information for a particular web site. Everytime a user accesses the page, the table is queried to display the correct links, graphics, etc. What I would like to do is when the web...
7
by: mike | last post by:
I have a number of sources of javascript and don't really know the sequence of when each gets loaded. <SCRIPT FOR="window" EVENT="onLoad"> var tmp = "where are you"; </script> <script...
3
by: Coskun Cavusoglu | last post by:
Hi, What I want to know is when a user clicks on a button I send him to another page by using the Response.Redirect("") method. But the page that the user is being sent to has to generate a...
1
by: Angel | last post by:
Is there a way to display a message using an aspx page with controls on it that the data is loading for the page without having to display one html page then reloading the aspx page. in other words...
4
by: blackhawk | last post by:
I need to build a web page that has to potentially display a large amount of data in two grids on the same page. The HTML file with all of the formatting is about 7MB in size. This is too large...
1
by: Jamil | last post by:
Hello, I am loading the user control daynamically using Page.LoadControl('mycontrol.ascx"). But with this i can not get my datamember's properties. For example i declare a private integer...
2
by: Jean Pierre Daviau | last post by:
When I have something like this in a js file. listeImg = new Array(); listeImg = new Image(w,h); listeImg.src = "centre1.jpg"; etc Are the images loaded after the page is loaded? In the same...
4
by: Nicolas R | last post by:
Hi all, Im trying to figure out how to display a 'loading' message when scripts are being executed, ie when the page is still not ready for interaction. This is for a web app which relies on...
0
by: teressa | last post by:
Hi, I am new to Grid view Control. I have a page with many icons on it for different purposes. I want to add a Grid View where I want to load data with different columns. Below is my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.