I'm trying to grab this url via curl. It works as you can see on the curl CLI, but when I try it in my code it doesn't work. % curl "http://data.fcc.gov/api/block/find?latitude=33.532559&longitude=-112.099305" <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Response xmlns="http://data.fcc.gov/api" executionTime="0.072" status="OK"><Block FIPS="040131067003003B"/><County name="Maricopa" FIPS="04013"/><State name="Arizona" code="AZ" FIPS="04"/></Response> $url = 'http://data.fcc.gov/api/block/find?latitude=' . $lat . '&longitude=' . $lng . '/'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch); print $result; Code (markup): It returns 'Not Found'. Any ideas?
try removing the forward slash from url $url = 'http://data.fcc.gov/api/block/find?latitude=' . $lat . '&longitude=' . $lng;
Doesn't work. It still returns a Not Found message. I'm really frustrated and have been working on this for like 5 hours trying to get this curl stuff to work.
Odd. This worked: $url = 'http://data.fcc.gov/api/block/find?latitude=' . $lat . '&longitude=' . $lng . "&format=json"; $output = file_get_contents($url); Code (markup):