Drupal http get Request for external URL?
this actually because of the second argument ['headers' => ['Accept' => 'text/html'] it tells the server to serve a plain text instead of html so your browser will end up print the text instead of parsing it as HTML,so just remove the second argument ['headers' => ['Accept' => 'text/html'] 

so you code will become like this one :

Code :

$url = 'xyz';

try {
  $response = \Drupal::httpClient()-&gt;get($url);
  $data = (string) $response-&gt;getBody();
  if (empty($data)) {
    return FALSE;
  }else{
    return $data;
  }
} catch (RequestException $e) {
  return FALSE;
}