Hello I am using the NOAA buoy RSS feed to create and insert variables into Mysql. There is a tag entitled:
<georss:point>45.565 -34.123</georss:point>
Which I have broken out as such:
$xmlString = file_get_contents($feed_url);
$xmlString = str_replace('georss:point','point',$xmlString);
$xml = new SimpleXMLElement($xmlString);
$items = $xml->xpath('channel/item');
$closeItems = array(); foreach($items as $item)
{
$latlng = explode(' ',trim($item->point));
$lat = $latlng[0];
$lng = $latlng[1];
}
However the issue that I am running into, the variables for $lat and $lng are the same for all the feed articles. Each article will have a unique $lat and $lng, so I know I am doing something wrong here. Thanks Again,
$latand$lng, as well as any intervening code that may alter their values?$latis always one value and$lngis another, but they are the same for every record?georssnamespace is just lazy. SimpleXML is capable of dealing with namespaces, see php.net/manual/en/simplexmlelement.children.php#example-4737