Новичок
Покинул форум
Сообщений всего: 6
Дата рег-ции: Окт. 2018
Помог: 0 раз(а)
|
CODE ( htmlphp):
скопировать код в буфер обмена
<html> <head> <title>XML Sitemap Generator</title> </head> <body> <form method="post" action="f.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>
-----------------
f.php
CODE ( htmlphp):
скопировать код в буфер обмена
<?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(",","c,?,?,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"); $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) { $i++; } } 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'; } ?>
Скрипт генерит карту сайта из ключей и сохраняет на компьютер.
Нужно сразу заливать по 1000000 ключей(указывать путь к файлу .txt с ключами) и что бы скрипт генерил много файлов sitemap-1,2,3,4.xml итд по 50000 ключей в каждом и сохранял на сервере.
Спасибо )
|