I have a simple IFrame of another site in my site:
<iframe name="frame1" src="http://www.walla.co.il" width="100%" height="400"></iframe>
That site doesn't belong to me in any way. I was looking for way go get the exact URL address of that site and post it as an echo so viewers could see the address of that site on my site. I found some scripts online but they didnt seem to work.
Is it even possible to do it? I am just looking for a way to echo it a variable (something like echo $url;)
This is what i've tried so far:
<iframe name="frame1" src="http://www.walla.co.il" width="100%" height="400"></iframe>
<?php
$htmlPage = file_get_contents("http://www.walla.co.il"); //the page has the iframe
if(preg_match_all("/<iframe[^>]*name=\"frame1\"[^>]*src=\"([^\"]+)\"[^>]*>/i", $htmlPage, $matches))
{
print_r($matches);
echo $matches[1][0];
}
?>