Display content from a remote URL is there a way to show content from an external URL (e.g. from GitHub) in a page?

I was using PHP code but because of security reasons I would prefer to use a module instead.

$c = curl_init();
curl_setopt($c, CURLOPT_URL, "https://raw.githubusercontent.com/foo/bar/master/file1.txt");
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);


I am looking to something similar to https://www.drupal.org/project/url_embed but without WYSIWYG. I just need to add some tags with the URL in the appropriate place on the page to display it.
Creating a custom module for this in Drupal would be quite easy if you focused on your specific use case.  You can find more info on that here:
https://www.drupal.org/docs/8/creating-custom-modules

More specifically, you may want to look at a custom block implementation:

https://www.drupal.org/docs/8/creating-custom-modules/creating-custom-blocks