用PHP休息

I am very new to PHP. I wanted to call restful api in PHP. I am doing same in jQuery as below

var url;
url = "https://www.example.com/_api/lists/getbytitle('Stations')/items?$select=CityCode,CityNameEN&$filter=Active eq 'Yes'&$orderby=CityNameEN";
        $.ajax({
            url: url,
            method: "GET",
            headers: { "Accept": "application/json; odata=verbose" },
            async: false,
            success: function (data) {
                $.each(data.d.results, function (i, item) {

                });
            }
        });

How can I do same in PHP. I have two difficulties. First in URL there is $ sign which PHP assume as variable and other I don't know how to do that

Using curl for sending HTTP request.

<?php
$url='https://www.kuwaitairways.com/_api/web/lists/getbytitle(\'Stations\')/items?$select=OfficeId&$filter=CityCode%20eq%20%27KWI%27';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/xml"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo $result = curl_exec($ch);

Hope this will help you.

$url="https://www.kuwaitairways.com/_api/web/lists/getbytitle('Stations')/items?";
$url .= "\$select=OfficeId&\$filter=".urlencode("CityCode eq 'KWI'");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/xml"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo $result = curl_exec($ch);

Check below code for fetching d:OfficeId node value

$office_id = "";
$xml=new DOMDocument;
$xml->loadXML($result);
$content_node = $xml->getElementsByTagName('content')->item(0);
foreach ($content_node->childNodes as $properties_node) {
    foreach ($properties_node->childNodes as $office_node) {
        $office_id = $office_node->nodeValue;
    }   
}