473,386 Members | 2,114 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,386 software developers and data experts.

Download Table to Excel in secure https for IE

I have the following code which has been working great in IE, FF, and Safari. However, it is not behind a certificate so it's https and now no longer works in IE. I am simply trying to download a SQL statement to XL.

I found some info here on the site about removing the no-cahce header but that does not help. If I remove the Content-Disposition header it loads XL in IE but does not find the data to open.

Can anyone help me find this answer?

Expand|Select|Wrap|Line Numbers
  1. $header = "";
  2. $data = "";
  3. $strSQL = "SELECT * FROM table";
  4. $result = mysql_query($strSQL);
  5. $fields = mysql_num_fields($result);
  6. for ($i = 0; $i < $fields; $i++) {
  7.     $header .= mysql_field_name($result, $i) . "\t";
  8. }
  9. while($row = mysql_fetch_row($result)) {
  10.     $line = '';
  11.     foreach($row as $value) {
  12.             if ((!isset($value)) OR ($value == "")) {
  13.                 $value = "\t";
  14.             } else {
  15.                 $value = str_replace('"', '""', $value);
  16.                 $value = str_replace("+", ",", $value);
  17.                 $value = '"' . $value . '"' . "\t";
  18.                 //if (substr($value,1,1) == ",") {
  19.                 //}
  20.             }
  21.         $line .= $value;
  22.     }
  23.     $data .= trim($line)."\n";
  24. }
  25. $data = str_replace("\r","",$data);
  26. if ($data == "") {
  27.     $data = "\n(0) Records Found!\n";
  28. }
  29. header("Content-type: application/vnd.ms-excel");
  30. header("Content-Disposition: attachment; filename=MyQuery.xls");
  31. header("Pragma: no-cache");
  32. header("Expires: 0");
  33. echo "$header\n$data";
  34.  
Feb 17 '10 #1
2 2029
It appears the solution in this case is a combination of removing the header("Pragma: no-cache"); and also adding session_cache_limiter("must-revalidate"); before any session_start commands.
Feb 17 '10 #2
Atli
5,058 Expert 4TB
Hey.

Glad you found a solution. Thanks for sharing it!

I've seen some very odd behavior in IE (odder that usual, that is) when doing data transfer via HTTPS. Never really found a solution. (Kind of just accepted it as another IE *bug*).

I'll have to keep this in mind next time that comes up :)
Feb 17 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Camel | last post by:
Hello All, I have a short program (see below ) that downloads a secure page. It worked fine when I changed in the InternetConnect function server name to: www.paypal.com port to:...
0
by: Chuck Anderson | last post by:
I am writing a Php script to run on my home PC (Windows) that downloads an Apache access log file and inserts new entries into a database.. The only way I can access these log files is through a...
1
by: com | last post by:
Extreme Web Reports 2005 - Soft30.com The wizard scans the specified MS Access database and records information such as report names, parameters and subqueries. ......
3
by: Pooja Renukdas | last post by:
Hello, I have this web site where only two pages have to be secure pages and I need to call them using https, but since I have my development server and my production web server, I dont want to...
2
by: TJS | last post by:
does ASP.net have a way to secure a delimited text file download ?
7
by: Brian Henry | last post by:
I created a project and it looks like everything is loading under HTTPS on all the pages perfectly except one page that it loads saying that the page contains both secure and non secure items......
8
by: vandenberc | last post by:
I am trying to setup an html page. I have a button and when you click on it I want it to go to either http:///.../demo.htm or https://..../demo.htm based on whether or not you went through the...
2
by: nandishp | last post by:
We need to automate download of Reports from Oracle CRM OnDemand. The reports in Siebel CRM OnDemand can be downloaded in the form of Excel, CSV, etc. We have a task of downloading several such...
5
by: sheldonlg | last post by:
I am top-posting this one time because this in new stuff and I am leaving the bottom for reference and description of the problem. I am also adding comp.lang.php as this is all done in php and...
0
by: Raven | last post by:
Hi, I have a problem with a server side redirect from a secure page to a non-secure page (same domain name, same folder) I have added some test code that can display the target URL and that...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.