A way to load xml sitemap its url |
Example:
PHP
<?php
$affectedRow = 0;
$url1 = 'https://wordpress.org/plugins/sitemap-2.xml';
$xml = simplexml_load_file("$url1") or die('Sorry');
foreach ($xml->children() as $row) {
$link = $row->loc;
echo $link;
echo '</br>';
if (! empty($result)) {
$affectedRow ++;
} else {
$error_message = mysqli_error($conn) . "\n";
}
}
if ($affectedRow > 0) {
$message = $affectedRow . " URLs have been crawled. It will index in the next crawl date";
} else {
$message = "No records inserted";
}
?>
<div class="affected-row"><?php echo $message; ?></div>
<?php if (! empty($error_message)) { ?>
<div class="error-message"><?php echo nl2br($error_message); ?></div>
<?php } ?>
How to add PHP File Get Content | PHP URL/LINK Tutorial |
How to add PHP cURL CURLOPT | PHP URL/LINK Tutorial |
How to load XML Sitemap URLs | PHP URL/LINK Tutorial |
How to get file size from a remote url in PHP | PHP URL/LINK Tutorial |
How to extract URLs from xml sitemap on PHP | PHP URL/LINK Tutorial |
Read Full: | PHP URL/LINK Tutorial |
Category: | Web Tutorial |
Sub Category: | PHP URL/LINK Tutorial |
Uploaded: | 5 months ago |
Uploaded by: | Admin |
Views: | 5 |
Tested on: | PHP 7 |