From 2987b2f79e20fc55399aee097469a16d20023b3c Mon Sep 17 00:00:00 2001 From: jorniks Date: Thu, 21 Apr 2022 18:02:59 +0100 Subject: [PATCH] update to retrieve image for medium Images --- index.php | 6 ++++++ 1 file changed, 6 insertions(+) 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 {