好的,我确实对这个 XML / php 脚本有一些问题
我有以下要通过 http 加载的 xml
<WowzaMediaServer>
<ConnectionsCurrent>3</ConnectionsCurrent>
<ConnectionsTotal>26</ConnectionsTotal>
<ConnectionsTotalAccepted>20</ConnectionsTotalAccepted>
<ConnectionsTotalRejected>6</ConnectionsTotalRejected>
<MessagesInBytesRate>3248.0</MessagesInBytesRate>
<MessagesOutBytesRate>1054.0</MessagesOutBytesRate>
<VHost>
<Name>_defaultVHost_</Name>
<TimeRunning>28752.989</TimeRunning>
<ConnectionsLimit>0</ConnectionsLimit>
<ConnectionsCurrent>3</ConnectionsCurrent>
<ConnectionsTotal>26</ConnectionsTotal>
<ConnectionsTotalAccepted>20</ConnectionsTotalAccepted>
<ConnectionsTotalRejected>6</ConnectionsTotalRejected>
<MessagesInBytesRate>3248.0</MessagesInBytesRate>
<MessagesOutBytesRate>1054.0</MessagesOutBytesRate>
<Application>
<Name>zahlio</Name>
<Status>loaded</Status>
<TimeRunning>3339.479</TimeRunning>
<ConnectionsCurrent>3</ConnectionsCurrent>
<ConnectionsTotal>14</ConnectionsTotal>
<ConnectionsTotalAccepted>14</ConnectionsTotalAccepted>
<ConnectionsTotalRejected>0</ConnectionsTotalRejected>
<MessagesInBytesRate>31595.0</MessagesInBytesRate>
<MessagesOutBytesRate>32045.0</MessagesOutBytesRate>
<ApplicationInstance>
<Name>_definst_</Name>
<TimeRunning>3339.478</TimeRunning>
<ConnectionsCurrent>3</ConnectionsCurrent>
<ConnectionsTotal>14</ConnectionsTotal>
<ConnectionsTotalAccepted>14</ConnectionsTotalAccepted>
<ConnectionsTotalRejected>0</ConnectionsTotalRejected>
<MessagesInBytesRate>31594.0</MessagesInBytesRate>
<MessagesOutBytesRate>32045.0</MessagesOutBytesRate>
<Stream>
<Name>zahlio</Name>
<SessionsFlash>2</SessionsFlash>
<SessionsCupertino>0</SessionsCupertino>
<SessionsSanJose>0</SessionsSanJose>
<SessionsSmooth>0</SessionsSmooth>
<SessionsRTSP>0</SessionsRTSP>
<SessionsTotal>2</SessionsTotal>
</Stream>
</ApplicationInstance>
</Application>
</VHost>
</WowzaMediaServer>
我要加载的数据是<SessionsFlash>
来自2
以<stream>
x 为名称且 x 为变量的数据,在本例中为 zahlio。
我使用这个http加载它:http://username:pwd@mydomian.com:8086/connectioncounts
这是我当前的 php 脚本:
$sxe = new SimpleXMLElement('http://username:pwd@mydomian.com:8086/connectioncounts');
$propNode = $sxe->xpath('/WowzaMediaServer/VHost/Application/ApplicationInstance/Stream');
$count = $propNode->getChildren("SessionsFlash");
它不起作用,我不知道如何从名为 x 的孩子那里选择 trh 数据