php domDocument分析xml文档

作者:袖梨 2022-07-02

 
 */
 
 $epg_info = $_GET['epg_info'];
    $epg_info = urldecode($epg_info);
    print_r($epg_info);
    //echo $epg_info;
    //exit();

    $doc = new DOMDocument();
    $xml = file_get_contents($epg_info);     //这里是我新改过的
    $doc->loadXML($xml);
  $server_ip = $doc->getElementsByTagName("server_ip")->item(0)->nodeValue;
    $group_name = $doc->getElementsByTagName("group_name")->item(0)->nodeValue;
    $group_path = $doc->getElementsByTagName("group_path")->item(0)->nodeValue;
    $oss_user_id = $doc->getElementsByTagName("oss_user_id")->item(0)->nodeValue;
    $page_url = $doc->getElementsByTagName("page_url")->item(0)->nodeValue;
  
    echo 'server_ip:'. $server_ip.'
';
    echo 'group_name:'. $group_name.'
';
    echo 'group_path:'. $group_path.'
';
    echo 'oss_user_id:'. $oss_user_id.'
';
    echo 'page_url:'. $page_url.'
';

相关文章

精彩推荐