1

here is what I'm trying to accomplish:

I have a file called url.php. When I access this file the only thing that shows up is a url.

I wanted to fetch this url and use it as a variable on a iframe in a different page.

Here is what I got:

<?php
$myvar = file_get_contents('http://localhost/url.php');
echo "<iframe src='$myvar' height="1800px" width="1900px" frameborder="0"></iframe>";
?>

But it doesnt seem to be working.

Parse error: syntax error, unexpected T_LNUMBER, expecting

Any suggestions? Thanks

user2479024
  • 61
  • 1
  • 3

2 Answers2

2

You need to watch your double quotes.

echo "<iframe src='$myvar' height='1800px' width='1900px' frameborder='0'></iframe>";

You also may be having issues since you're using it on localhost:

PHP file_get_contents does not work on localhost

Community
  • 1
  • 1
musicnothing
  • 3,977
  • 24
  • 43
0

When echo'ing with variables inside always double check your quotes.

Try this:

echo "<iframe src='".$myvar."' height='1800px' width='1900px' frameborder='0'></iframe>";
Sergio
  • 28,539
  • 11
  • 85
  • 132