My url is:
http://www.mapquestapi.com/geocoding/v1/batch?key=dNBvDLtTx85L3akdg8vBoHQXrWpDJSEI&location=HEBRON,KY,US&location=CINCINNATI,KY,US&location=CINCINNATI,KY,US&location=BEDFORD PARK,IL,US&location=BEDFORD PARK,IL,US&location=HODGKINS,IL,US&location=HODGKINS,IL,US&location=HODGKINS,IL,US&location=BALDWIN PARK,CA,US&location=BALDWIN PARK,CA,US&location=BALDWIN PARK,CA,US&location=,,US
It's long but it should be compliant with https://www.mapquestapi.com/geocoding/
The mystery unfolds when I run the following php code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_URL, $urlForGeocode);
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
$return = curl_exec ($ch);
curl_close ($ch);
echo( $return);
$output = shell_exec('curl ' . $urlForGeocode);
echo( $output);
The variable $urlEncode holds the value of the url above. The first output is:
<html><body><b>Http/1.1 Bad Request</b></body> </html>
The output of the second request is:
{
    "info": {
        "statuscode": 400,
        "copyright": {
            "text": "\u00A9 2016 MapQuest, Inc.",
            "imageUrl": "http://api.mqcdn.com/res/mqlogo.gif",
            "imageAltText": "\u00A9 2016 MapQuest, Inc."
        },
        "messages": ["no 'json' parameter found"]
    },
    "options": {
        "maxResults": -1,
        "thumbMaps": true,
        "ignoreLatLngInput": false
    },
    "results": [{
        "providedLocation": {},
        "locations": []
    }]
}
Those two different cURL requests return basically the same thing. When I run the cURL from my terminal on my local machine, a 400 is returned as well.
If I put the URL in my browser though, I'm not disappointed, and it returns the data I'm looking for with a 200 status code.
What is different between a browser get request and the cURL?
