doucuo4413 2015-09-02 18:33
浏览 40

从cURL XML获取价值

I fetch data from an XML feed using cURL. I need to get a specific value from the XML.

The XML feed is here.

I need the text: Gymnázium Christiana Dopplera (<D:Nazev>)

I've tried using DOMDocument, but I get a "Fatal error".
What am I doing wrong?

if ($curl = curl_init("http://wwwinfo.mfcr.cz/cgi-bin/ares/darv_sko.cgi?ico=61385701")) {
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $content = curl_exec($curl);
    curl_close($curl);
}

$dom = new DOMDocument();
$dom = loadXML($content);
echo $dom->getElementsByTagName("Nazev");

Fatal error: Call to undefined function loadXML() in C:\www\pokusy\ares\index.php on line 13

  • 写回答

2条回答 默认 最新

  • doupai1876 2015-09-02 18:41
    关注

    SimpleXML will convert the entire XML document into a object and you can go from there.

    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测