Fix encoding issue

This commit is contained in:
2020-10-03 01:24:27 +05:00
parent 8c63a57af4
commit 4b8394bd94

View File

@@ -1,4 +1,5 @@
<?php
namespace App\Services;
use Illuminate\Support\Facades\Http;
@@ -15,11 +16,11 @@ class Client
{
$response = Http::get($url);
if(!$response->ok())
{
if (!$response->ok()) {
throw new \Exception("Error getting the rss feed");
}
return json_decode(json_encode(simplexml_load_string($response->body())), true);
// Decode Html entity before passing the data to xml loader to decode
return json_decode(json_encode(simplexml_load_string(html_entity_decode($response->body()))), true);
}
}