使用php从索引页面获取文本

is there any way to get text only from a page? for here's example

i have index.php , page1.php , page2.php

now on index.php i write this below then i will create those page1 and page2..

<div id="pg1"><a href="page1.php">Hello page 1</a></div>
<div id="pg2"><a href="page2.php">Hello page 2</a></div>

now on page1 and page2 i create divs like this below..

<div id="getpg1">WHEN page1.php opened, HERE MOST BE TEXT THAT IS ON index.php on div id pg1. get text from that div</div>

<div id="getpg2">WHEN page2.php opened, HERE MOST BE TEXT THAT IS ON index.php on div id pg2. get text from that div</div>

hope you understand. it simply means when a page opened it most get the text that i pointed from index.php

Sorry, took me a moment to fix something here first. So here you go:

On your index.php put between <head></head>:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $(".page").on("click",function(e){
        e.preventDefault();

        var link = $(this).attr("href");
        var content = $(this).html();

        window.location.href = link + "?content=" + content;
    });
});
</script>

And change your divs to:

<div id="pg1"><a href="page1.php" class="page">Hello page 1</a></div>
<div id="pg2"><a href="page2.php" class="page">Hello page 2</a></div>

On your page1.php and page2.php, simply use:

<div id="getpg1"><?php echo $_GET['content']; ?></div>