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.

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';

Use single quotes.

Then re-read the docs

Have you tried this?

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