Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

php syntax

Avatar of blossompark
blossomparkFlag for Ireland asked on
JavaScriptPHPWeb Development Software
6 Comments1 Solution602 ViewsLast Modified:
Hi,
    when i call  the curl.php file in a browser, it displays the location information related to the supply coordinates
 
<?php
$curl_handle=curl_init();
//curl_setopt($curl_handle,CURLOPT_URL,'http://maps.google.com/maps/api/geocode/json?latlng=$lat,$lng&sensor=false');
curl_setopt($curl_handle,CURLOPT_URL,'http://maps.google.com/maps/api/geocode/json?latlng=53.290695,-6.273949&sensor=false');
curl_exec($curl_handle);
curl_close($curl_handle);

?>

i now want to supply the coordinates in a query string for example,
http://URL/curl.php?lat=53.123456&lng=-6.123456
however I'm having problems with the syntax in the  line below when i try to embed the variables in the query string...have played around with it but not getting the correct result
curl_setopt($curl_handle,CURLOPT_URL,'http://maps.google.com/maps/api/geocode/json?latlng=$lat,$lng&sensor=false');

any help appreciated
<?php
$lat = $_GET['lat'];
$lng = $_GET['lng'];
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://maps.google.com/maps/api/geocode/json?latlng=$lat,$lng&sensor=false');
curl_exec($curl_handle);
curl_close($curl_handle);

?>
ASKER CERTIFIED SOLUTION
Avatar of iobox
ioboxFlag of Italy imageWeb Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers