I used this script to load the page but instead of loading the page it saved it as an .xls file

header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=Sched.xls");
// Fix for crappy IE bug in download.
header("Pragma: ");
header("Cache-Control: ");

Works no problem on my pc server running xampp>apache but when i upload it to my yahoo server it doesnt work instead it just loads the page but doesnt even load fully
Here is the site uploaded to yahoo www.medellincebu.com/uscsched2 after pasting sched in the box press submit then the table that it shows is the table i want to export to .xls try pressing :export to excel: and that is my problem
You can use this as sample data you have to include the last [tab] character when copying
http://medellincebu.com/scheds.txt
any help would be appreciated thanks!

Your wording is a bit confusing but it does seem that you're trying to export to a .xls file. The code that I use (that works) is:

        header("Content-type: application/msworks");
        header("Content-Disposition: attachment; filename=$dfw_filename");
        header("Pragma: no-cache");
        header("Expires: 0");
        print "$dfw_header\n$dfw_data";

This is included in my desktop_file_write module that you can download at:
Click Here

Yes I am trying to export the page as a .xls, the code you posted works fine on my pc-server running apache, but as soon as i upload it to yahoo servers it just gives me the same output as the code i posted

I tried it on your site and one thing that doesn't make sense to me is that the screen display changes when you click the button to download the xls file. My understanding using a Header like this is that it is all or nothing. You can't display screen output and create an output file in the same execution of a module. When I use a Header like this, the screen doesn't change and the only thing that happens is that the file is downloaded. If you have any output prior to the Header statement you get errors and the Header doesn't work. If it is working in your Wamp environment, then I presume that you don't see any change in the screen display when you execute it there. If that is the case, then the logical conclusion is that Yahoo has some impact on this. It appears that the Header statement isn't being acted on so the output is still going to the screen. 'Header' is a PHP function so there is a possibility that it isn't working or hs been disabled on the Yahoo server. Suggest that you talk to their support people.

yes the screen shouldnt change you are right, I am now using some javascript to solve the problem seems to be working fine now, Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.