I use the curl function to get information from a certain webpage. In the following code the URL is static:
$curl = curl_init('http://00.00.0.00/route/v1/driving/12.869446,54.990799;12.045227,54.044362?overview=full&steps=true');
curl_setopt($curl, CURLOPT_PORT, 5000);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 5000);
$result = curl_exec($curl);
But the part's lat lng (12.869446,54.990799) in the URL need to be php variables like: $lng
, $lat
.
My first solution doesn't work:
$lat = '54.990799';
$lng = '54.990799';
$curl = curl_init('http://00.00.0.00/route/v1/driving/$lng,$lat;12.045227,54.044362?overview=full&steps=true');
My second solution with " doesn't work either:
$curl = curl_init('http://00.00.0.00/route/v1/driving/"$lng","$lat";12.045227,54.044362?overview=full&steps=true');
Can anyone help me with the best solution?