Background:
I have a project to move data accessed via an API to another application. The code is in PHP and at the moment I cannot access the "url" within the returned JSON string.
$json = '{"data": [{"vehicle": {"id": "2122233","name": "MY REG"},"files": [{"vin": "WMARR44444W146311","createdAtTime": "2020-08-05T00:25:47.388Z","url": "https://tachograph-files43679/2020/8/5/WMA24XZZ7BW146311/1596587147388-b6785431-c2e1-41ff-b7af-9bb078654882.ddd?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-XXXXXXXXXXXXX","id": "XXXXXXXXX"}]}],"pagination": {"endCursor": "XXXXX-be93-44b2-91a2-095af9f1c301","hasNextPage": false}}';
Here is the JSON string (sensitive data removed). Once I get the result I then have to use the URL in another call to retrieve the file data.
If I use json_decode($json) I get an error.
If I use jsondecode($json,true) the URL is not accessible.
I know that the problem is an object within the JSON string but I can't figure out how to access it.
Ultimately I will have multiple vehicles and multiple files referenced in the JSON.
So, I would like to loop through the JSON and then make another call to download the data file.
Any help appreciated.
Thanks Malcolm