• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
seegatesite header

Seegatesite.com

Seegatesite.com - Programming Tutorial , Sharing , How and Learn Together

  • TOOLS
    • Bootstrap Navbar Online Generator
    • Customize Sidebar Menu Bootstrap 3
    • Bootstrap Demo
  • ADVERTISE
  • CATEGORIES
    • Android
    • Blogging Tips
    • Database
    • CSS
    • Info Gadget
    • Javascript
    • Linux
    • PHP
    • Various
    • WordPress
  • Q&A
  • PHP
  • JAVASCRIPT
  • JQUERY
  • ANGULAR
  • WORDPRESS
  • SEO
  • REACT
🏠 » PHP » [Share My Old Stuff] Tutorial Create XML Sitemap Generator From Lists Of Keywords

[Share My Old Stuff] Tutorial Create XML Sitemap Generator From Lists Of Keywords

By Sigit Prasetya Nugroho ∙ April 16, 2017 ∙ PHP ∙ Leave a Comment

Share : TwitterFacebookTelegramWhatsapp

I want to share my old stuff tool to create a sitemap XML file. Maybe there are some people who need these tools to improve their website index. Let’s follow the following tutorial

Of course, you already know what it is XML sitemap.

A sitemap is a list of pages and posts a website that can be accessed by visitors of the website/blog. Although not significantly affect the visitors, but the sitemap is extremely influential in our efforts to optimize our SEO blog. XML Sitemap in a blog will tell the search engines such as Google, Yahoo, etc. to index the list in search engines.

How To Create Xml Sitemap Generator From Lists Of Keyword With Php

If you have a website that is in the build without a CMS such as WordPress, of course, have to create your own plugin that will generate a sitemap XML file. And for a handful of people is very useful tool to add a new index to the search engine. Straight to the point follow these steps.

Table of Contents

  • 1 Tutorial how to create XML sitemap generator from a collection of keywords
    • 1.1 Thus tutorial create a sitemap generator XML file using PHP, may be useful

Tutorial how to create XML sitemap generator from a collection of keywords

1. Create a project folder with the name “sitemap”

2. Create an index.php file and copy the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php header('Content-Type: text/html; charset=utf-8'); ?>
<html>
<head>
<title>XML Sitemap Generator</title>
</head>
<body>
 
<h2>How to create xml sitemap file from keyword lists</h2>
 
 
<form method="post" action="file.php" target="_blank">
 
<table>
<tr>
<td>Url</td>
 
 
<td>:
<input type="text" name="url" size="80">
</td>
 
</tr>
 
 
<tr>
<td>Priority</td>
 
 
<td>:
<input type="text" value="0.8" name="priority">
</td>
 
</tr>
 
 
<tr>
<td>Change Frequently</td>
 
 
<td>:
<select name="changefreq">
<option value="always">always</option>
<option value="hourly">hourly</option>
<option value="daily" selected>daily</option>
<option value="weekly">weekly</option>
<option value="monthly">monthly</option>
<option value="yearly">yearly</option>
<option value="never">never</option>
</select>
</td>
 
</tr>
 
 
<tr>
<td>Keyword</td>
 
 
<td>: <textarea name="keyword" cols=50 rows=30></textarea></td>
 
</tr>
 
 
<tr>
<td colspan=2><button type="submit" name="submit">Submit</button></td>
</tr>
 
</table>
 
</form>
 
</body>
</html>

3. Create file.php file and copy the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php function text_to_strip($text) { return str_replace(" ", "-", seotext($text)); } function seotext($str) { $str = str_replace("(", "", $str); $str = str_replace(")", "", $str); $str = str_replace("&", "", $str); $str = str_replace(",", "", $str); $str = str_replace("]", "", $str); $str = str_replace(";", "", $str); $str = str_replace("[", "", $str); $str = str_replace("!", "", $str); $str = str_replace('"', '', $str); $str = str_replace("_", "", $str); $str = str_replace("/", "", $str); $str = str_replace("@", "", $str); $str = str_replace("$", "", $str); $str = str_replace("%", "", $str); $str = str_replace("^", "", $str); $str = str_replace("~", "", $str); $str = str_replace("*", "", $str); $str = str_replace("'", "", $str); $str = str_replace("|", "", $str); $str = str_replace("+", "", $str); $str = str_replace(":", "", $str); $str = str_replace("?", "", $str); $str = str_replace("#", "", $str); $str = str_replace(".", "", $str); $str = str_replace("}", "", $str); $str = str_replace("{", "", $str); $variable = explode(",","ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,e,i,ø,u,é"); $replace = explode(",","c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,e,i,o,u,e"); $i=0; foreach ($variable as $key=> $value) {
$str = str_replace($value, $replace[$i], $str);
$i++;
}
$str = implode('-',array_filter(explode('-',$str)));
return strtolower($str);
}
if($_POST['keyword']<>'' or $_POST['priority']<>'' or $_POST['url']<>'' or $_POST['changefreq']<>'')
{
$text = explode("\n", $_POST['keyword']);
$content = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
foreach ($text as $key => $value) {
$content .='<url>';
$content .='<loc>'.$_POST['url'].text_to_strip($value).'</loc>';
$content .='<lastmod>'.date("c").'</lastmod>';
$content .='<changefreq>'.$_POST['changefreq'].'</changefreq>';
$content .='<priority>'.$_POST['priority'].'</priority>';
$content .='</url>';
}
$content .='</urlset>';
header('Content-Description: sitemap xml');
header('Content-type: text/xml');
header('Content-disposition: attachment; filename=sitemap-a.xml');
header('Content-Length: '.strlen($content));
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
header('Pragma: public');
echo $content;
exit;
}else{
echo 'All of input field can not be empty';
}
?>

Please run this application via localhost: http://localhost/sitemap/

Please see the following snippet of how these tool work

If already formed XML file, please upload on your hosting and register the sitemap.XML file on google and bing webmaster. To change or add a sitemap parameters, please visit the sitemap official website to add a standard sitemap protocol

Thus tutorial create a sitemap generator XML file using PHP, may be useful

Another PHP Related Post :

  • How To Replace String With Another String In PHP
  • Login Page – Tutorial CRUD Client and API Server Using JQuery And Lumen Part 2
  • Tutorial CRUD Client and API Server Using JQuery And Lumen Part 1
  • How To Solve Problems Illegal mix of collations (latin1_swedish_ci,IMPLICIT) In Laravel
  • How To Resolve No ‘Access-Control-Allow-Origin’ Header In Lumen
  • How To Create Custom Class In Laravel 5.5 For Beginners

Avatar for Sigit Prasetya Nugroho

About Sigit Prasetya Nugroho

This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Welcome to my Home,

Avatar for Sigit Prasetya NugrohoThis site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.



Popular Articles

Checked checkbox AdminLTE Bootstrap in Jquery

November 4, 2014 By Sigit Prasetya Nugroho 7 Comments

Simple create date format validation with jqueryUI

December 21, 2014 By Sigit Prasetya Nugroho Leave a Comment

Create Simple Progress Bar for Fake Online Generator with Jquery

January 10, 2015 By Sigit Prasetya Nugroho Leave a Comment

22+ Coolest Free Jquery Plugin For Premium Theme

October 3, 2015 By Sigit Prasetya Nugroho Leave a Comment

Easy Build Your Anti Copy Paste Plugin

October 6, 2015 By Sigit Prasetya Nugroho Leave a Comment

Popular Tags

adminlte (15) adsense (13) adsense tips (4) affiliate amazon (13) amazon (12) Android (8) angular (16) angular 4 (12) angular 5 (4) asin grabber (3) Bootstrap (27) codeigniter (5) create wordpress theme (5) crud (8) css (6) free wordpress theme (7) google adsense (4) imacros (4) increase traffic (6) jquery (34) laravel (10) laravel 5 (5) learn android (5) modal dialog (5) mysql (6) nodeJs (4) optimize seo (4) pdo (6) php (30) plugin (53) pos (7) Publisher Tips (5) react (3) Reactjs (7) SEO (37) theme (17) tutorial angular (5) tutorial angular 4 (6) tutorial javascript (10) tutorial javascript beginners (4) twitter (3) widget (3) wordpress (18) wordpress plugin (13) XMLRPC (5)




  • About
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms and Conditions

©2021 Seegatesite.com