开发者

PHP XML Break Apart Values

I am importing an RSS feed from the NOAA website which is returned as RSS. The latitude and longitude values are returned as one tag which is below:

<georss:point>40.369 -73.703</georss:point>

Is it possible to 'break' apart these values and create two variables such as:

$lat = 40.369
$lng = -73.703

Here is my PHP script that is currently parsing out the XML:

$rss_title = $RSS_DOC->channel->title;
$rss_link = $RSS_DOC->channel->link;
$rss_editor = $RSS_DOC->channel->managingEditor;
$rss_c开发者_开发问答opyright = $RSS_DOC->channel->copyright;
$rss_date = $RSS_DOC->channel->item->pubDate;
$rss_description = $RSS_DOC->channel->item->description;

Appreciate any resource to get me pointed in the right direction. thanks,


Yes, not too hard. Explode (edited - thanks @sdleihssirhc):

http://php.net/manual/en/function.explode.php

E.g.:

list($latt, $long) = explode(" ", $RSS_DOC->channel->item->point);

Hope it works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜