0

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.

0

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

0

As suggested, i created a Drupal module (based on jmolivas/gist_embed) with allows to embed text content from external URLs on a Drupal page:

see: https://github.com/panticz/embed_url

Suggestions / improvements and co-development are as always welcome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.