How to echo xml file in php

前端 未结 10 880
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 04:37

How to print an xml file to the screen in php?

This is not working:

$curl = curl_init();        
curl_setopt ($curl, CURLOPT_URL, \'http://rss.news.y         


        
10条回答
  •  庸人自扰
    2020-11-29 05:02

    If you just want to print the raw XML you don't need Simple XML. I added some error handling and a simple example of how you might want to use SimpleXML.

    channel->item as $item) {
        print $item->title;   
    }
    

提交回复
热议问题