简体   繁体   中英

parse rss feed while exclude some text

i am trying to parse the user names from an rss feed using php, but for some reason its not working correctly here is my code.

$feedDom = new DomDocument();
$feedDom ->load($TURL);
$xPath = new DomXPath($TwitterDom);
$usernames = $xPath->xpath("//author/name']");


echo $usernames;

I looked at the rss feed and here is what i am trying to parse, but I would like to exclude the (jimmy), and only parse the user name.

<author>
      <name>ilovemyname (jimmy)</name>
</author>

像这样?

$usernames = substr($usernames, 0, strpos($usernames, ' '));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM