-2

Possible Duplicate:
Extracting the content of an element from an external page

Is there any way to put external page into my page but not with iframe. Currently I using:

<?php

$homepage = file_get_contents('http://www.google.com/');
echo $homepage;

?>

but this is not really elegant solution. Is there some elegant solution for this? maybe with jquery, java script, php ... or some other ... ??? What I need is to show external page but to can see the source code od that external page...

UPDATE: some browser in browser solution or something similar???

Community
  • 1
  • 1
JO JOJO
  • 105
  • 9
  • 1
    You want to _display_ the source code for an external page, or the page itself? In the latter case, use an ` – Bojangles Dec 11 '11 at 23:42
  • 1
    I hope you're considering copyright laws in this too... but how is that not an "elegant solution"? It's straight-forward and simple. – animuson Dec 11 '11 at 23:42
  • 1
    Yes, i if the possible can show the iframe but how to get the source code of external page that showing on my page becouse i'm must have access to source code beouse i needs elements (div,span,p,a,li) – JO JOJO Dec 11 '11 at 23:45

1 Answers1

2

If you want to show the source code of an external page on your page:

<?php

  $url = 'http://www.google.com/';

?>
<html>
  <head>
    <title>HTML source of <?php echo $url; ?></title>
  </head>
  <body>
    <pre>
<?php echo htmlspecialchars(file_get_contents($url)); ?>
    </pre>
  </body>
</html>
DaveRandom
  • 87,921
  • 11
  • 154
  • 174
  • It,s OK but I'm need to show this code like html like in browser, the source code is behind... i need something that will work like browser! – JO JOJO Dec 11 '11 at 23:53