dsgtew3241 2014-04-04 14:27
浏览 22

PHP没有使用完整的URL?

This is my code:

<?php
$url = "https://api.datamarket.azure.com/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT?$filter=Kenteken%20eq%20%2701GBB1%27";
$xml =  simplexml_load_file($url);
?>

Im trying to get this .XML file into my $url. The problem is that its using https://api.datamarket.azure.com/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT and not the one with the filter: https://api.datamarket.azure.com/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT?$filter=Kenteken%20eq%20%2701GBB1%27

Why is it not taking the URL i entered there? When i open the URL in my browser i get the filtered one but when i run the code itll give me the other .XML.

I hope someone can help me.

  • 写回答

3条回答 默认 最新

  • doumi1944 2014-04-04 14:30
    关注

    You are using double quotes, so php will interpret $filter as a (probably undefined...) variable.

    You can avoid that using single quotes:

    $url = 'https://api.datamarket.azure.com/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT?$filter=Kenteken%20eq%20%2701GBB1%27';
    
    评论

报告相同问题?

悬赏问题

  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了