duanbaque4230 2016-04-13 14:14
浏览 29

使用PHP从url检索XML信息

I have this URL witch in my web browser leads me to a XML feed.

http://mandeo.meteogalicia.es/thredds/ncss/grid/modelos/WRF_HIST/d03/2016/04/wrf_arw_det_history_d03_20160413_0000.nc4?var=temp&latitude=41.15&longitude=-8.6166667&accept=xml

The problem is i can't retrieve it's information using cURL or file_get_contents. The curious thing was that yesterday at my home i could retrieve it using this block of code:

if (($response_xml_data = file_get_contents($this->url_request))===false){
            echo "Error fetching XML
";
        } else {
           libxml_use_internal_errors(true);
           $data = simplexml_load_string($response_xml_data);
           if (!$data) {
               echo "Error loading XML
";
               foreach(libxml_get_errors() as $error) {
                   echo "\t", $error->message;
               }
           } else {
              print_r($data);
           }
        }*/

Today the same block of code in the same computer enviromment but in a different network throws me this error message:

Message: file_get_contents(http://mandeo.meteogalicia.es/thredds/ncss/grid/modelos/WRF_HIST/d03/2016/04/wrf_arw_det_history_d03_20160413_0000.nc4?var=temp%2Cprec%2Cu%2Cv%2Cdir%2Cvisibility&point=true&latitude=41.15&longitude=-8.6166667&accept=xml): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known

Anyone has any ideas to workaround this? Thank you!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 我的数据无法存进链表里
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
    • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
    • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
    • ¥15 如何在炒股软件中,爬到我想看的日k线
    • ¥15 seatunnel 怎么配置Elasticsearch
    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端