Browse Source

return error info after finding feeds if available

pull/60/head v1.4.12
Aaron Parecki 6 years ago
parent
commit
0decb9dcb4
No known key found for this signature in database GPG Key ID: 276C2817346D6056
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      lib/XRay/Feeds.php

+ 10
- 2
lib/XRay/Feeds.php View File

@ -35,11 +35,19 @@ class Feeds {
$url = normalize_url($url); $url = normalize_url($url);
$result = $this->http->get($url); $result = $this->http->get($url);
if(isset($result['error']) && $result['error']) {
return [
'error' => $result['error'],
'error_description' => $result['error_description']
];
}
$body = $result['body']; $body = $result['body'];
$feeds = []; $feeds = [];
// First check the content type of the response
// First check the content type of the response
$contentType = isset($result['headers']['Content-Type']) ? $result['headers']['Content-Type'] : ''; $contentType = isset($result['headers']['Content-Type']) ? $result['headers']['Content-Type'] : '';
if(is_array($contentType)) if(is_array($contentType))
@ -110,7 +118,7 @@ class Feeds {
return [ return [
'url' => $result['url'], 'url' => $result['url'],
'code' => $result['code'], 'code' => $result['code'],
'feeds' => $feeds
'feeds' => $feeds,
]; ];
} }

Loading…
Cancel
Save