Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



php get domain from referrer

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 11-05-2010
Member
 
Join Date: Mar 2010
Posts: 71
php get domain from referrer
  

Hi all,

I am in little bit trouble and need to know something about the manipulation of referrer, In such scenario, can somebody show me how to take the referrer, and strip out http:// and the page part of the URL. Entirely, I want left is the domain like as www.Techarena.in ...

Thanks !!


Last edited by Seducer : 11-05-2010 at 12:48 PM.
Reply With Quote
  #2  
Old 11-05-2010
Member
 
Join Date: Feb 2008
Posts: 1,848
php get domain from referrer

If you need to access the domain name of the referrer then you can create a script in PHP which can made you able to get the domain name, I am going to show you the script written here and I hope it would be much helpful for you, please take a look here ..

Code:
<?php
if (isset($_SERVER['HTTP_REFERER']))
{
      $array = parse_url($_SERVER['HTTP_REFERER']);
      echo $array['host'];
}

?>
Reply With Quote
  #3  
Old 11-05-2010
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: php get domain from referrer

Referrer is the URL from where the visitor get access on the page. If you are currently accessing the page by clicking a link from google.com then google URL would be referrer for you for this page. We can get the referrer by using PHP. This is useful for the webmasters to find out that from where the traffic for the site is gathering . Which advertisement campaign is getting higher views and which is not. We will also know the keywords used by the visitors in so mnay search engines to arrive at the site. Here is the easy script to find out the referrer in PHP
Code:
$ref=@$HTTP_REFERER;

echo "<font face='Verdana' size='3'><b>Referrer of this page  = $ref </b>";
Reply With Quote
  #4  
Old 11-05-2010
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: php get IP from referrer

We can find out the IP address of any user visiting on the page by using PHP. Finding the IP address is very important need for several scripts where we store the members or visitors information . For security causes, we can store IP address of our visitors who are committing any purchases or recording the geographical location of the visitor can be performed this way. Some time based on the IP address, we can redirect the browser to another areas of the web site. There are several applications using this and here is the PHP code to know the IP address of any visitor to the site.
Code:
$ip=@$REMOTE_ADDR;
echo "<b>IP Address= $ip</b>";
The above code would evaluate the result in this for with the visitors IP address= 122.182.10.138..
Reply With Quote
  #5  
Old 11-05-2010
Member
 
Join Date: May 2008
Posts: 2,008
Re: php get domain from referrer

We can gather IP address of the guests by using Request object and its ServerVariable pairs. IP address of the user is needed in several applications for separate purposes. IP address are gathered and logged for security purposes on separate occasions like credit card process, member signup time etc. From the IP address we can find out the location of the guest. However we will prevent ourselves only to know how to gather IP address of the guest browser from the HTTP header information.

In PHP we can find out the IP address and details are here. In ASP programming as we will use the http header information so it is good to read the whole article on http header and request object and is freely available on the net. We will use http header name REMOTE_ADDR or HTTP_HOST to find out the IP address. Here is the code.

<%= Request.ServerVariables("HTTP_ADDR")%>


The above IP value ( data ) can be used for several purposes.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "php get domain from referrer"
Thread Thread Starter Forum Replies Last Post
An active directory Domain Controller for the domain could not becontacted in windows vista Business CheyeNnne Active Directory 7 28-12-2010 10:05 PM
Return the title, URL and referrer in JavaScript document KALLIYAN Software Development 3 10-12-2009 12:32 AM
I have got two domain, I can't ping FQDN, Domain name but not the hostname of the other domain kaikoa Networking & Security 1 16-09-2009 10:11 AM
backup domain controller in a small business server 2003 domain Ashish Goenkar Small Business Server 4 31-01-2009 12:16 AM
Child domain user does not show parent domain group membership Pratim Active Directory 1 19-06-2008 01:58 AM


All times are GMT +5.5. The time now is 11:21 PM.