Jump to content

Getting Url of Site hosting Iframe


Mbarrio

Recommended Posts

Okay so here is what I'm looking to do, pretty new to php as you will tell by my code  . The code I have works great for Site1 and Site3 but is what I'm trying to accomplish is:
Site1 is hosting the site which dynamicly shows content according to Url name. Does this great. But now I would like Site2 to be just an Iframe of Site1 and have it display dynamic content for Site2 not Site1

Here is the code I have... I hope this makes sense

[code]function getDomain($url)
{
    if(filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED) === FALSE)
    {
        return false;
    }
    /*** get the url parts ***/
    $parts = parse_url($url);
    /*** return the host domain ***/
    return $parts['scheme'].'://'.$parts['host'];
}

<?php
$domain = getDomain($url);
if ($domain = 'http://Site1') {$service='xxxxxx';} // show the phone numbers
if ($domain = 'http://Site2') {$service='xxxxxx';} // show the phone numbers
if ($domain = 'http://Site3') {$service='xxxxxx';} // show the phone numbers
echo '<p style="margin:0px 0px 10px 0px; font-size: 20px; font-weight:bold;"><img src="call-us.gif" alt="'.$service.' Questions" title="'.$service.' Questions" width="24" height="24" class="alignnone size-full wp-image-219" />  '.$service.'</p>
<p style="margin:0px; font-size: 20px; font-weight:bold;"><img src="call-us.gif" alt="'.$service.' Questions" title="'.$service.' Questions" width="24" height="24" class="alignnone size-full wp-image-219" />  '.$service.'</p>';
?>

Link to comment
https://forums.phpfreaks.com/topic/202306-getting-url-of-site-hosting-iframe/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.