I am outputting to my error log with this code:
ob_start();
var_dump($_COOKIE['agl-values']);
error_log(ob_get_clean());
The output is:
[02-Apr-2018 16:12:58 UTC] string(321) "{\"latitude\":\"42.2470259\",\"longitude\":\"-71.1755274\",\"altitude\":\"NaN\",\"accuracy\":\"29\",\"altitudeAccuracy\":\"NaN\",\"heading\":\"NaN\",\"speed\":\"NaN\",\"error_code\":\"\",\"error_message\":\"\",\"php_time\":1522684274,\"php_date\":\"2018-04-02 15:51:14\",\"php_date_format\":\"Y-m-d H:i:s\",\"user_id\":0}"
[02-Apr-2018 16:12:58 UTC] string(321) "{\"latitude\":\"42.2470259\",\"longitude\":\"-71.1755274\",\"altitude\":\"NaN\",\"accuracy\":\"29\",\"altitudeAccuracy\":\"NaN\",\"heading\":\"NaN\",\"speed\":\"NaN\",\"error_code\":\"\",\"error_message\":\"\",\"php_time\":1522684274,\"php_date\":\"2018-04-02 15:51:14\",\"php_date_format\":\"Y-m-d H:i:s\",\"user_id\":0}"
[02-Apr-2018 16:12:58 UTC] string(321) "{\"latitude\":\"42.2470259\",\"longitude\":\"-71.1755274\",\"altitude\":\"NaN\",\"accuracy\":\"29\",\"altitudeAccuracy\":\"NaN\",\"heading\":\"NaN\",\"speed\":\"NaN\",\"error_code\":\"\",\"error_message\":\"\",\"php_time\":1522684274,\"php_date\":\"2018-04-02 15:51:14\",\"php_date_format\":\"Y-m-d H:i:s\",\"user_id\":0}"
[02-Apr-2018 16:12:58 UTC] string(321) "{\"latitude\":\"42.2470259\",\"longitude\":\"-71.1755274\",\"altitude\":\"NaN\",\"accuracy\":\"29\",\"altitudeAccuracy\":\"NaN\",\"heading\":\"NaN\",\"speed\":\"NaN\",\"error_code\":\"\",\"error_message\":\"\",\"php_time\":1522684274,\"php_date\":\"2018-04-02 15:51:14\",\"php_date_format\":\"Y-m-d H:i:s\",\"user_id\":0}"
I just need to access the latitude and longitude variables. How do I isolate one of the cookies, and then how do I turn it into JSON?
UPDATE
I checked json_last_error() and it is telling me the string has a syntax error - could it be the escaped double quotes?