Files
MermsWebsite2021/app/Services/WpContentsClient.php
T
2021-10-02 19:45:48 -04:00

27 lines
617 B
PHP

<?php
namespace App\Services;
use GuzzleHttp\Client as HTTPClient;
class WpContentsClient
{
public static function serviceGetBlogItems($apiEndpointsUrl)
{
$client = new HTTPClient();
try {
$response = $client->request(
'GET',
"{$apiEndpointsUrl}/wordpress-data",
['connect_timeout' => 2, 'timeout' => 3, 'debug' => false]
);
} catch (Exception $e) {
// echo "\n".$e->getMessage()."\n";
$response= []; // empty array
}
return json_decode($response->getBody());
}
}