/
sitemap3.php
62 lines (59 loc) · 1.84 KB
/
sitemap3.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
require_once 'classes/common_funs.php';
$cf = new Commonfuns();
$serverName = $cf->constants('serverName');
$sql = "SELECT bank_id,branch_name FROM ifsc_codes";
$rs1 = mysql_query($sql);
$qry = "select * from bank_names;";
$rs = mysql_query($qry);
while($row = mysql_fetch_assoc($rs))
{
$id = $row['id'];
$bank_name = $row['bank_name'];
$bank_details[$id] = $bank_name;
}
$bank_branch_names = array();
while($row = mysql_fetch_assoc($rs1))
{
$bank_id = $row['bank_id'];
$bank_name = $bank_details[$bank_id];
$branch_name = $row['branch_name'];
$url = $serverName.$cf->sanitizeUrl("bank-ifsc-code/".$bank_name."/".$branch_name."-branch");
$bank_branch_names [] = array('loc'=>strtolower($url));
}
$count = round(count($bank_branch_names)/25000);
$ini = 0;
for($k=1;$k<=$count;$k++){
$c = $k*25000;
$data[$k] = array_slice($bank_branch_names,$ini,25000);
$ini = $c+1;
}
//print_r(count($data));
//echo "<br/>";
//print_r($data);exit;
for($j = 1;$j<=$count;$j++){
$doc = new DOMDocument('1.0','utf-8');
$doc->formatOutput = true;
$r = $doc->createElement( "urlset" );
$r->appendChild(
new DomAttr( 'xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9')
);
$r->appendChild(
new DomAttr( 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance')
);$r->appendChild(
new DomAttr( 'xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd')
);
$doc->appendChild( $r );
foreach( $data[$j] as $employee )
{
$b = $doc->createElement( "url" );
$name = $doc->createElement( "loc" );
$name->appendChild(
$doc->createTextNode( $employee['loc'] )
);
$b->appendChild( $name );
$r->appendChild( $b );
}
$doc->save("sitemaps/sitemapa$j.xml");
}
?>