diff --git a/index.php b/index.php index 4b15fba..6e7ace7 100644 --- a/index.php +++ b/index.php @@ -27,6 +27,12 @@ $path = $xmlQueryString; $xml = simplexml_load_file($path); $json = xmlToArray($xml); + foreach ($json['rss']['channel']['item'] as $key => $value) { + $imageSrc = explode('"', explode('src', $value['encoded'])[1]); + if ($imageSrc[1] !== '') { + $json['rss']['channel']['item'][$key]['postImage'] = $imageSrc[1]; + } + } echo json_encode($json); return; } else {