Jump to content

Get the domain name of a website which includes my includes file


o3xa

Recommended Posts

how to get the domain name of a website which includes my includes file.

 

The code would need to be put within my includes file so when any site includes it the file will get the sites domain. to  $currentDomain

 

i have tried using:

 

echo file_get_contents()

 

instead of includes but i get the same issue I get back the includes domain.

 

then code i have tried (in the includes file):

 

$curdomain1= $_SERVER['HTTP_HOST'];

$pageUR1  = ereg_replace("/(.+)", "", $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); 
$curdomain2  = str_replace("www.", "", $pageUR1);

echo "<br> 1# Current Domain: ".$curdomain1;
echo "<br> 2# Current Domain: ".$curdomain2;

How are you including this file?  If you include it via a file path, eg:

include('/path/to/include.php');

 

Then the domain should just be in $_SERVER['HTTP_HOST'].  If your including it as a URL though, say

include('http://www.yoursite.com/include.php');

 

Then you have to pass the domain as a parameter in the query string in order to get it in the include.

 

How are you including this file?  If you include it via a file path, eg:

include('/path/to/include.php');

 

Then the domain should just be in $_SERVER['HTTP_HOST'].  If your including it as a URL though, say

include('http://www.yoursite.com/include.php');

 

Then you have to pass the domain as a parameter in the query string in order to get it in the include.

 

 

hi there thanks for the response.

 

i have included it like this:

 

<?php include("http://o3xa-seo.info/bata-links.php?amount=10"); ?>

 

the includes works but as i put the:

$currentDomain = $_SERVER['HTTP_HOST'];

in the included php file i get the domain of the included file 'o3xa-seo.info' not the domain of the website which has the include code: http://www.rizzlekicks.org/  look at the footer. for the result.

 

is there a way around this, maybe a bit of javascript? any help welcome :) thanks

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.