fork download
  1. <?php
  2. $xml = '<?xml version="1.0" encoding="UTF-8"?>
  3. <urlset xmlns="http://w...content-available-to-author-only...s.org/schemas/sitemap/0.9">
  4. <url>
  5. <loc>http://w...content-available-to-author-only...m.br/numero/123/</loc>
  6. <lastmod>2005-01-01</lastmod>
  7. <changefreq>monthly</changefreq>
  8. <priority>0.8</priority>
  9. </url>
  10. <url>
  11. <loc>http://w...content-available-to-author-only...m.br/numero/124/</loc>
  12. <lastmod>2005-01-01</lastmod>
  13. <changefreq>monthly</changefreq>
  14. <priority>0.8</priority>
  15. </url>
  16. <url>
  17. <loc>http://w...content-available-to-author-only...m.br/numero/125/</loc>
  18. <lastmod>2005-01-01</lastmod>
  19. <changefreq>monthly</changefreq>
  20. <priority>0.8</priority>
  21. </url>
  22. <url>
  23. <loc>http://w...content-available-to-author-only...m.br/numero/126/</loc>
  24. <lastmod>2005-01-01</lastmod>
  25. <changefreq>monthly</changefreq>
  26. <priority>0.8</priority>
  27. </url>
  28. </urlset>';
  29.  
  30. $urlset = simplexml_load_string($xml);
  31.  
  32. foreach($urlset as $url) {
  33. if (preg_match('#www\.site\.com\.br/numero/([^/]+)/#', $url->loc, $match)) {
  34. $numeros[] = $match[1];
  35. }
  36. }
  37.  
  38. var_dump($numeros);
  39.  
Runtime error #stdin #stdout #stderr 0.01s 82880KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Fatal error:  Uncaught Error: Call to undefined function simplexml_load_string() in /home/dxPjwI/prog.php:30
Stack trace:
#0 {main}
  thrown in /home/dxPjwI/prog.php on line 30