Hi,
I am still at procedural style programming. And so, oop code sample codes really do bug & confuse me.
I do not understand these ‘–>’.
I am used to ().
I found this oop style php code that parses xml files for links.
Any chance someone can show me how to convert this to procedural style ?
Oh yes. Test the code. It really woks fine!
But if anyone finds a simple procedural style php code then do let me know.
Thanks
[code]
// sitemap url or sitemap file
$sitemap = ‘https://bytenota.com/sitemap.xml’;
// get sitemap content
$content = file_get_contents($sitemap);
// parse the sitemap content to object
$xml = simplexml_load_string($content);
// retrieve properties from the sitemap object
foreach ($xml->url as $urlElement) {
// get properties
$url = $urlElement->loc;
$lastmod = $urlElement->lastmod;
$changefreq = $urlElement->changefreq;
$priority = $urlElement->priority;
// print out the properties
echo ‘url: ‘. $url . ‘<br>’;
echo ‘lastmod: ‘. $lastmod . ‘<br>’;
echo ‘changefreq: ‘. $changefreq . ‘<br>’;
echo ‘priority: ‘. $priority . ‘<br>’;
echo ‘<br>—<br>’;
}