Graph 上 cURL 请求的未定义索引 API

Undefined index on cURL request on Graph API

我正在使用 Facebook 的图表 API 通过 PHP 中的 cURL 调用检索一些数据,但我收到未定义的索引错误,我不知道如何正确定位它.

cURL 请求:

<?php
/* Call the cURL request to pull in Instagram images */
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, "https://graph.facebook.com/v5.0/". get_option('insta_id') ."/media?fields=media_url,permalink,username,media_type,thumbnail_url&access_token=". get_option('insta_accesstoken'));
$result = curl_exec($curl);
$array = json_decode($result, true);
?>

数组映射:

<?php
/* Loop through the array and only pull API fields */
$mediaUrls = array_map(function($entry) {
    return [
        'media_url' => $entry['media_url'],
        'permalink' => $entry['permalink'],
        'username' => $entry['username'],
        'media_type' => $entry['media_type'],
        'thumbnail_url' => $entry['thumbnail_url']
    ];
}, $array['data']);
?>

通过图表 API,有些有 thumbnail_url 而有些没有,如下所示:

我收到如下调试错误:

@CD001 的 'thumbnail_url' => !empty($entry['thumbnail_url']) ? $entry['thumbnail_url'] : "" 是正确答案。