I am getting response from the API like this
[{"destination_url":"https://www.smh.com.au/business/the-economy/australia-s-workplaces-are-transforming-search-where-the-jobs-will-be-in-2024-20180418-p4zaal.html?promote_channel=edmail&mbnr=MjAyNTgyMjU&eid=email:nnn-13omn654-ret_newsl-membereng:nnn-04%2F11%2F2013-news_am-dom-news-nnn-age-u&campaign_code=13INO010&et_bid=29124074&list_name=40_smh_newsalert&instance=2018-04-18--20-11--UTC",
"doc_id":"17014",
"main_url":"http://click.email.fairfaxmedia.com.au/?qs=b3370d8980e989c9e39909e0291c60d501f8a164477f9e049f07626b2a9c7e79da7d38ad705d7713e024559ecf2f217f79f8c08f728ab7fe",
"redirect_urls":"http://click.email.fairfaxmedia.com.au/?qs=b3370d8980e989c9e39909e0291c60d501f8a164477f9e049f07626b2a9c7e79da7d38ad705d7713e024559ecf2f217f79f8c08f728ab7fe||http://www.smh.com.au/business/the-economy/australia-s-workplaces-are-transforming-search-where-the-jobs-will-be-in-2024-20180418-p4zaal.html?promote_channel=edmail&mbnr=MjAyNTgyMjU&eid=email:nnn-13omn654-ret_newsl-membereng:nnn-04%2F11%2F2013-news_am-dom-news-nnn-age-u&campaign_code=13INO010&et_bid=29124074&list_name=40_smh_newsalert&instance=2018-04-18--20-11--UTC"
}]"
Now I have to access the doc_id
from this. Here's what I've tried:
$landerProperties = $request->data;
$landerProperties = json_decode(json_encode($landerProperties,true),true);
$id = (int)$landerProperties[0]['doc_id'];
foreach ($landerProperties as $key => &$value) {
unset($value['doc_id']);
}
But it's giving me an exception: Illegal string offset 'doc_id'
. Please tell me how to access the data from here.