Ich möchte aus einem XML File Werte auslesen, irgendwie bekomme ich das aber nicht hin.
Kann mir jemand einen Tipp geben wie ich hier duration und aspectRatio auslese?
$string = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="1" librarySectionTitle="Filme" librarySectionUUID="3b5d87f9-ac04-4436-8ee3-f876c144120d" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1566914114">
<Video ratingKey="345218" key="/library/metadata/345218" guid="com.plexapp.agents.imdb://tt2911666?lang=de" librarySectionTitle="Filme" librarySectionID="1" librarySectionKey="/library/sections/1" studio="Warner Bros. Pictures" type="movie" title="John Wick" contentRating="FSK 16" summary="Als Iosef (Alfie Allen), der Sohn des russischen Mafiabosses Viggo Tarasov (Michael Nyqvist) und seine Crew einen Witwer überfallen, dessen Auto stehlen und dessen Hund töten, ahnen sie nicht mit wem sie es zu tun haben. Der Trauernde ist niemand anders als der frühere Profikiller John Wick (Keanu Reeves) und der Hund war das letzte Geschenk seiner verstorbenen Gattin Helen (Briget Moynahan). Wick, der früher in Viggos Diensten stand, kennt nur noch einen Gedanken: Rache. Der Gangsterboss mobilisiert seine Truppen um das Leben seines Sohnes zu schützen, doch Wick war der Beste seines Faches und hat nichts verlernt..." rating="7.3" year="2014" tagline="Rache kennt keine Gnade" thumb="/library/metadata/345218/thumb/1561911578" art="/library/metadata/345218/art/1561911578" duration="6119031" originallyAvailableAt="2014-10-22" addedAt="1561911096" updatedAt="1561911578" chapterSource="media" primaryExtraKey="/library/metadata/345219">
<Media id="578260" duration="6119031" bitrate="65547" width="3840" height="2160" aspectRatio="1.78" audioChannels="8" audioCodec="truehd" videoCodec="hevc" videoResolution="4k" container="mkv" videoFrameRate="24p" videoProfile="main 10">
<Part accessible="1" exists="1" id="583799" key="/library/parts/583799/1510208151/file.mkv" duration="6119031" file="D:\ServerFolders\Filme UHD\John Wick (2014)\John Wick (2014) German Dubbed DTSHD DL 2160p UHD BluRay HDR HEVC.mkv" size="50175824369" container="mkv" deepAnalysisVersion="4" requiredBandwidths="110179,105094,102607,99438,97664,95890,89447,85323" videoProfile="main 10">
<Stream id="1084370" streamType="1" default="1" codec="hevc" index="0" bitrate="57525" bitDepth="10" chromaSubsampling="4:2:0" colorPrimaries="bt2020" colorRange="tv" colorSpace="bt2020nc" colorTrc="smpte2084" frameRate="23.976" height="2160" level="153" profile="main 10" refFrames="1" requiredBandwidths="101242,93925,91339,87741,85967,84194,78744,74577" width="3840" displayTitle="4K (HEVC Main 10 HDR)" />
<Stream id="1084371" streamType="2" selected="1" default="1" codec="dca" index="1" channels="6" bitrate="2436" language="Deutsch" languageCode="ger" audioChannelLayout="5.1(side)" bitDepth="16" profile="ma" requiredBandwidths="2768,2663,2494,2454,2454,2454,2454,2454" samplingRate="48000" title="Deutsch DTS-HD MA 5.1 NIMA4K" displayTitle="Deutsch (DTS-HD MA 5.1)" />
<Stream id="1084372" streamType="2" codec="truehd" index="2" channels="8" bitrate="4916" language="English" languageCode="eng" audioChannelLayout="7.1" bitDepth="24" requiredBandwidths="7828,7587,7115,6592,6166,5830,4982,4958" samplingRate="48000" title="English TrueHD Atmos 7.1 NIM4K" displayTitle="English (TRUEHD 7.1)" />
<Stream id="1084373" streamType="2" codec="ac3" index="3" channels="6" bitrate="640" language="English" languageCode="eng" audioChannelLayout="5.1(side)" requiredBandwidths="640,640,640,640,640,640,640,640" samplingRate="48000" title="English Dolby Digital 5.1 NIMA4K" displayTitle="English (AC3 5.1)" />
<Stream id="1084374" streamType="3" codec="pgs" index="4" bitrate="13" language="Deutsch" languageCode="ger" headerCompression="1" requiredBandwidths="69,69,69,69,69,69,69,69" title="Deutsch NIMA4K" displayTitle="Deutsch (PGS)" />
<Stream id="1084375" streamType="3" default="1" codec="pgs" index="5" bitrate="1" language="Deutsch" languageCode="ger" headerCompression="1" requiredBandwidths="34,34,34,34,34,34,34,34" title="Deutsch Forced NIMA4K" displayTitle="Deutsch (PGS)" />
<Stream id="1084376" streamType="3" codec="pgs" index="6" bitrate="16" language="English" languageCode="eng" headerCompression="1" requiredBandwidths="69,69,69,69,69,69,69,69" title="English NIMA4K" displayTitle="English (PGS)" />
<Stream id="1084377" streamType="3" codec="pgs" index="7" bitrate="0" language="English" languageCode="eng" headerCompression="1" requiredBandwidths="39,39,39,39,39,39,39,39" title="English Forced NIMA4K" displayTitle="English (PGS)" />
</Part>
</Media>
</Video>
</MediaContainer>
XML;
$xml = simplexml_load_string($string);
print_r($xml);
$aspect_ratio = $xml->Media['aspectRatio'];
var_dump($aspect_ratio);
zu finden unter
<Media id="578260" duration="6119031" bitrate="65547" width="3840" height="2160" aspectRatio="1.78"