Tipps und Tricks » kleine webmaster FAQ
ID #1809
wie kann man eine google XML sitemap in Textlinks konvertieren ?
Hallo,
das geht am einfachsten mit PHP-DOM:
Source file
01 <?php 02 03 getmyurl("sitemap.xml","yahoo_sitemap1.txt"); 04 # powered by minipipes 05 # usage 06 # converting google-xml-sitemap to text 07 08 function getmyurl($xml_file,$output_file){ 09 echo "..laden.. bitte warten"; $texturl=""; $meldung="<br>das hat leider nicht geklappt"; 10 $xml_file=@file_get_contents($xml_file); 11 if($xml_file!="") { 12 13 14 $xmlurls=array(); $texturl=""; $aus=0; 15 $mydom=new DOMDocument; 16 $mydom->loadxml($xml_file); 17 $xmlurls=$mydom->getelementsbytagname('loc'); 18 19 20 foreach($xmlurls as $myt) { 21 $texturl.=$myt->textContent."\r\n"; 22 23 } 24 echo "<br>sitemap erfolgreich geladen"; 25 26 $mytest=@file_put_contents($output_file,$texturl); 27 @chmod($output_file,0777); 28 29 if($mytest>0){ 30 31 $meldung= "<br>Erfolgreich gespeichert";} 32 } else{ 33 $meldung.=": sitemap konnte nicht geladen werden"; 34 } 35 echo $meldung; 36 } 37 38 39 40 ?>
.
.
Tags: DOM, PHP, sitemap, webmaster, XML
Verwandte Artikel:
- Vorschaubilder in der sitemap anzeigen
- Kauf einer airbrush-Pistole
- Vorsicht bei Laptop Kühler Samsun M-Kiss Mini ubs notebook cooler
Letzte Änderung des Tests: 2015-05-15 15:00
Autor: pipe
Leser: 2828 (1.33 pro Tag )
Revision: 1.0
..