Reputation: 61
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
Upvotes: 1
Views: 337
Reputation: 3985
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
Upvotes: 2
Reputation: 28837
When echo'ing with variables inside always double check your quotes.
Try this:
echo "<iframe src='".$myvar."' height='1800px' width='1900px' frameborder='0'></iframe>";
Upvotes: 0