Getting the URL address from an IFrame on my site with PHP -
i have simple iframe of site in site:
<iframe name="frame1" src="http://www.walla.co.il" width="100%" height="400"></iframe> that site doesn't belong me in way. looking way go exact url address of site , post echo viewers see address of site on site. found scripts online didnt seem work.
is possible it? looking way echo variable (something echo $url;)
this i've tried 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 iframe if(preg_match_all("/<iframe[^>]*name=\"frame1\"[^>]*src=\"([^\"]+)\"[^>]*>/i", $htmlpage, $matches)) { print_r($matches); echo $matches[1][0]; } ?>
yeah can that:
$htmlpage = '<iframe name="frame1" src="http://www.walla.co.il" width="100%" height="400"></iframe>'; //the page has iframe if(preg_match_all("/<iframe[^>]*name=\"frame1\"[^>]*src=\"([^\"]+)\"[^>]*>/i", $htmlpage, $matches)) { //print_r($matches); echo $matches[1][0]; } this not tested though...
edit: don't know trying accomplish in here can't that. html string of iframe should inside variable. see updated answer...
Comments
Post a Comment