<?php

// Create pages 
    $file_handle = fopen('separate-regions.csv', 'r');
    $list_content = "";

    while(!feof($file_handle)) 
    {
        $line = fgetcsv($file_handle, 1024);
        $city   = $line[0];
        $code   = $line[1];
        $city_all = $line[2];
        $city_link = '0'.$code.'-numbers-'.strtolower(str_replace("- ","",str_replace(")","",str_replace("(","",str_replace(" ","-",$city))))).'.html';
        
        $add_line =  "<url>\r\n";
        $add_line .= "\t<loc>http://www.phone-numbers-uk.com/geographic-numbers/".$city_link."</loc>\r\n";
        $add_line .= "\t<lastmod>2012-10-22T21:49:09+00:00</lastmod>\r\n";
        $add_line .= "</url>\r\n";
        
        $list_content .= $add_line;     
    }
    fclose($file_handle);
    
    echo $list_content;
?>