PHP Grab URL of Current Site, but from a master file hosted on a server
Hey guys basically I have a master file hosted on a server, and what it does is echo a list of links to a bunch of other sites. The set of links it grabs is based on the URL of the current site. The problem I'm having is that using $_SERVER['REQUEST_URI']
on a server produces the url of that server and I want it produce the url of the site 开发者_如何学编程that my master page is loaded in to
<?php
$url = parse_url($_GET['url']);
$str = $url['host'];
echo $str;
if ($str < "g"){
//do stuff
echo(" has first character lower than g");
}
else{
echo(" has not first character lower than g");
}
?>
You would need to pass the client servers hostname into the $_GET['url']
then look for it in the [query]
key outputted by parse_url($_GET['url']);
<?php
//client side host
file_get_contents('http://server.site.com/masterfile.php?url='.$_SERVER['HTTP_HOST']);
?>
If I understand you correctly. :s
精彩评论