0

I have the following iFrame HTML:

<html>
<iframe src="page.php" id="ifrm" height = 100%  width = 100% ></iframe>
</table>
</html>

I use it to display PHP inside an html page.

However, iframes are giving me a very hard time. Is there any other solution without using an iFrame?

What i Need basically is for the HTML page to display the php page without changing the browser url.

BTW: Both pages are on different servers.

Thx!

6
  • Depending on what the PHP script is doing, this won't work. Commented Mar 22, 2017 at 12:37
  • You mean that iFrame is the only solution to this? Commented Mar 22, 2017 at 12:39
  • No, its not what I want to say. There are some other solutions. I want to say that depending on what the page is doing you want to include, you can't use the functions of this page. So, you can display it, but may userinputs won't bring you the result you want. Commented Mar 22, 2017 at 12:44
  • Have you considered using an ajax call? You could then load the page manually with Javascript... Commented Mar 22, 2017 at 12:45
  • What's that </table> closing tag doing there? Commented Mar 22, 2017 at 13:04

2 Answers 2

1

You could try just reading the file in with file_get_contents, and then print it:

<?php
    $sContent =  file_get_contents('page.php'); //Replace 'page.php' with the full URI to the pages you want to show
    print ($sContent);
?>

This will work with most server setups, although not always.

Sign up to request clarification or add additional context in comments.

1 Comment

Does not work... it's basically an html page, not a PHP. I need a solution somehow with HTML if possible.
0

You can use the function file_get_contents('http://urlforsite.com/page')

$externalWebsite = 'http://externalsite.com/page';
$externalContent = file_get_contents($externalWebsite);
echo $externalContent;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.