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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:28:19+00:00 2026-05-29T13:28:19+00:00

This tutorial here is a good source of generating kml from the database using

  • 0

This tutorial here is a good source of generating kml from the database using php… http://code.google.com/apis/kml/articles/phpmysqlkml.html

However my problem is that when the script is ran, the file that is generated is saved as .php, not as .kml. How can I make it to be as .kml? Below is the specific code. Thanks!

<?php 
$kml = array('<?xml version="1.0" encoding="UTF-8"?>'); 
$kml[] = '<kml xmlns="http://www.opengis.net/kml/2.2">'; 
$kml[] = '<Document>'; 
$kml[] = '</Document>'; 
$kml[] = '</kml>'; 
$kmlOutput = join("\n", $kml); 
header('Content-type: application/vnd.google-earth.kml+xml'); 
echo $kmlOutput; 
?> 
  • 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-29T13:28:20+00:00Added an answer on May 29, 2026 at 1:28 pm

    The file you are accessing to generate the file probably has a php extension, thus the browser thinks that is the extension of what you are downloading

    Make sure you set in your headers the filename with the extension:

    header('Content-Disposition: attachment; filename="file.kml"');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running through this tutorial found here: http://vb.net-informations.com/crystal-report/vb.net_crystal_report_from_multiple_tables.htm which teaches how to pass a
I'm learning by reading this tutorial: Link Here's the code: <?php require_once 'Zend/Loader.php'; class
I'm aggregating RSS feeds using FeedTools. I followed this tutorial: http://simonwoodside.com/weblog/2008/12/7/ruby_on_rails_feedrss_aggregator/ and everything functioned
So I found this: http://tiles.apache.org/framework/tutorial/advanced/nesting-extending.html Here is the example: <definition name=myapp.homepage template=/layouts/classic.jsp> <put-attribute name=title
Here is a link to the tutorial that I am referring to. This seems
This tutorial on mobileorchard.com uses 2 classes (or 2 sets of .h and .m)
I'm following this tutorial (seems good) for Rails. After I run ruby script/generate scaffold
Over here in symfony's tutorial , it says: Hide all ids Another good practice
I found a great tutorial on creating an MVC App from Scratch using Sencha
I'm having a problem when trying to compile the program in this tutorial from

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.