HTML Content Maintenance

I need a way to serve either HTML or links to external web pages. Basically, what we need to do is to have web pages, and then we would like to provide the user of our site with a URL or part of javascript to be inserted into their own page, which will then display our HTML on their page at loading.

Can someone help me in the right direction?

Thank!

+3
source share
3 answers

What you need is an iframe tag.

+4
source

You can use javascript to pull content from your site.

<script src="http://youdomain.com/mycontent.js">
</script>

then in your js file use

var myhtml ='';

myhtml += "Put your html in here";
document.write(myhtml);
0
source
<?php
// JsAdServer.php Copyright(c) 2013 by Phillip S. Smith Enterprises
// ok to use but include my copyright notice in code.

$htmlcontent=file_get_contents($url);
// you may also use curl or any other method to populate $htmlcontent

$jsContent=$htmlcontent;
$jsContent=preg_replace('/>\s+</','><',$jsContent);
$jsContent=str_replace("<hr />",'',$jsContent);// remove if hr required
$jsContent=str_replace(chr(13),'',$jsContent);
$jsContent=str_replace(chr(10),'',$jsContent);
$jsContent=str_replace("'","\'",$jsContent);
$jsContent=str_replace('a href="','a target="new" rel="nofollow" href="',$jsContent);
print "document.write('$jsContent');";
?>
-1

Source: https://habr.com/ru/post/1765606/


All Articles