zoukankan      html  css  js  c++  java
  • php解析xml

        $con = file_get_contents("http://v.guozitv.com/api/androidxml.php?");
        $data = simplexml_load_string($con);
        print_r($data);
        echo $data->details;
        exit;
    $doc = new DOMDocument();
    $doc->load( $xgweb );
    $books = $doc->getElementsByTagName( "item" );
    
    foreach( $books as $book )
    {
        $authors = $book->getElementsByTagName( "author" );
        $author = $authors->item(0)->nodeValue;
        $pubDate = $book->getElementsByTagName( "pubDate" );
        $pubDate = $pubDate->item(0)->nodeValue;
        $titles = $book->getElementsByTagName( "title" );
        $title = $titles->item(0)->nodeValue;
        $descriptions = $book->getElementsByTagName( "description" );
        $description = $descriptions->item(0)->nodeValue."...";
        $links = $book->getElementsByTagName( "link" );
        $link = $links->item(0)->nodeValue;
        echo "$title - $author - $pubDate - $description - $link ". '<br/>'. '<br/>'. '<br/>'. '<br/>';
    }
  • 相关阅读:
    两种称谓
    HDU 1074

    Educational Codeforces Round 44
    nowcoder—Beauty of Trees
    nowcoder-练习赛16
    c++作业-8
    差的东西
    nowcoder-挑战赛14
    BZOJ2548 [CTSC2002] 灭鼠行动
  • 原文地址:https://www.cnblogs.com/kevin0709/p/3195741.html
Copyright © 2011-2022 走看看