Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create geoRss feed

I am new to geoRss.

How can we write the geoRss feed. I have my lat long values and some other fields in mysql db which i want to add in the geoRss feed.

Thanks and Regards, Ashish

like image 299
Ashish Pethkar Avatar asked Feb 01 '26 22:02

Ashish Pethkar


1 Answers

Try this code to output geoRSS

header("Content-type: text/xml");
    $xml_output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
    $xml_output .= "<rss version=\"2.0\" 
      xmlns:geo=\"http://www.w3.org/2003/01/geo/wgs84_pos#\" 
      xmlns:dc=\"http://purl.org/dc/elements/1.1/\">";

    $xml_output .= "<channel>";
    $xml_output .= "<title>My GeoRSS</title>
     <description>Description here</description>
     <link>http://url-here.com/</link>
     <dc:publisher>your_name</dc:publisher>
     <pubDate>Wed, 13 Apr 2011 23:56:15 PST</pubDate>
     <item>
       <pubDate>Wed, 13 Apr 2011 23:56:15 PST</pubDate>
       <title>Feed title</title>
       <description>Feed description</description>
       <link>Feed URL</link>
       <geo:lat>Latitude</geo:lat>
       <geo:long>Longitude</geo:long>
     </item>
   </channel>
</rss>
";

print $xml_output;

Replace the respective fields as taken from your database..

like image 65
Muhammad Ummar Avatar answered Feb 04 '26 12:02

Muhammad Ummar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!