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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:07:11+00:00 2026-06-10T04:07:11+00:00

I have build a simple site map script, i am not able to get

  • 0

I have build a simple site map script, i am not able to get URL output in URL field.

My PHP Script.

    header("Content-Type: text/xml;charset=iso-8859-1");
    echo '<?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
          xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
          http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
    ';

    require_once('_ls-global/php/sr-connect.php');
    $db = mysql_select_db($database,$connection) or trigger_error("SQL", E_USER_ERROR);
    $sqlquery = mysql_query("SELECT * FROM $tablename ORDER by id")or die (mysql_error());

    while ($list = mysql_fetch_assoc($sqlquery)){

      $pflink=$list['pflink'];
      $pagelink=$list['pagelink'];

      $site="http://mysite.com";

      $url='$site/$pflink/$pagelink';

      $changefreq="weekly";
      $priority="1.0";

      echo '<url>
          <loc>'.$url.'</loc>
          <changefreq>'.$changefreq.'</changefreq>
          <priority>'.$priority.'</priority>
            </url>';

    }

    echo '</urlset>';

The Output of this script is this.

    <url>
    <loc>$site/$pflink/$pagelink</loc>
    <changefreq>weekly</changefreq>
    <priority>1.0</priority>
    </url>

If i change $url='$site/$pflink/$pagelink'; to $url="$site/$pflink/$pagelink";

then i get only one value and error “XML Parsing Error: not well-formed”.

Please see and suggest any modification to make it work.

Thanks

  • 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-06-10T04:07:13+00:00Added an answer on June 10, 2026 at 4:07 am

    I guess you are having characters in the vars which are messing up the XML.

    For example &, ä, <, >… You need to encode the content correctly.

    Try wrapping the output:
    At first change $url to $url = $site .'/'. $pflink .'/'. $pagelink; and then update the output of the XML to:

    <?php
    // ...
          echo '<url>
              <loc><![CDATA['.$url.']]></loc>
              <changefreq>'.$changefreq.'</changefreq>
              <priority>'.$priority.'</priority>
                </url>';
    ?>
    

    Explanation to CDATA available at http://en.wikipedia.org/wiki/CDATA

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For a client I have build a simple script that uploads multiple files(images), resizes
I have a simple jQuery script that I'm trying to build upon but I
I have a simple site to develop and would like to learn PHP as
I want to build simple camel application, which will get xml from URL and
I have a site built with simple templates; header.tpl, navigation.tpl, body_home.tpl, body_about.tpl, body_anotherpage.tpl, etc.
I'm trying to build a really simple php controller page for a small site.
I am going to build a site that have dynamic content (properties as title,
I'm trying to build a simple custom search for a Wordpress site using PHP
I have build a simple website with ASP.NET C#. It runs normally after I
I'm trying to build the simple layout that I have got in the image

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.