Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP没有使用完整的URL?_Php - Fatal编程技术网

PHP没有使用完整的URL?

PHP没有使用完整的URL?,php,Php,这是我的代码: <?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); ?> 我正在尝试将这个.XML文件放入我的$url中。问题是它的使用 而不是带过滤器的: ?$filter=Kenteken%20

这是我的代码:

<?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);
?>

我正在尝试将这个.XML文件放入我的$url中。问题是它的使用 而不是带过滤器的: ?$filter=Kenteken%20eq%20%2701GBB1%27

为什么它不接受我在那里输入的URL?当我在浏览器中打开URL时,我会得到一个经过过滤的URL,但当我运行代码时,它会给我另一个.XML


我希望有人能帮助我。

您使用的是双引号,因此php将
$filter
解释为一个(可能未定义的…)变量

您可以避免使用单引号:

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

您使用的是双引号,因此php将把
$filter
解释为一个(可能未定义的…)变量

您可以避免使用单引号:

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

然后使用单引号

那你试过这个了吗

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

$xml = new SimpleXMLElement(file_get_contents($url));
?>

您试过这个吗

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

$xml = new SimpleXMLElement(file_get_contents($url));
?>


Pff太简单,sry在这里浪费你的时间。Pff太简单,sry在这里浪费你的时间。