Pulling Keywords from referrer url

Discussion in 'PHP' started by theduke56789, Dec 26, 2005.

  1. ilook

    ilook Well-Known Member

    Messages:
    1,602
    Likes Received:
    15
    Best Answers:
    1
    Trophy Points:
    165
    #21
    ilook, Sep 23, 2008 IP
  2. Paintball Guns

    Paintball Guns Active Member

    Messages:
    173
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    60
    #22
    Has anyone had any luck getting these to work? I'm not a PHP programmer, so maybe that's part of the problem. I just need a simple script that says, "You came from [search engine] and searched for [search phrase]." Anyone have anything like this? Or can you explain how to use the PHP code on this page to accomplish this?
     
    Paintball Guns, Nov 3, 2008 IP
  3. purnachender

    purnachender Guest

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #23
    This is really great and simple code to pull out the keywords and search engine.

    can you pls give code to decide whether that referer url is paid one or normal search link?

     
    purnachender, Aug 3, 2009 IP
  4. rontdu

    rontdu Member

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #24
    I use this code and also use another code:
    
    <?php
    // take the referer
    $thereferer = strtolower($_SERVER['HTTP_REFERER']);
    // see if it comes from google
    if (strpos($thereferer,"google")) {
    	// delete all before q=
        $a = substr($thereferer, strpos($thereferer,"q="));		
    	// delete q=
    	$a = substr($a,2);
    	// delete all FROM the next & onwards
    	if (strpos($a,"&")) {
    		$a = substr($a, 0,strpos($a,"&"));
    	}	
    	// we have the results.
    	$mygooglekeyword = urldecode($a);
    }
    ?>
    
    PHP:
    But all of them face a problem and they can't calculate the keyword when i am login on google,gmail etc.
    I mean that when i am login in google and on the same browser when i search and go to the page then this code don't calculate the keyword.
    Please give me solve , Its urgent.
     
    rontdu, Nov 20, 2011 IP
  5. akbarul

    akbarul Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #25
    This is very good share. I thing I will save this then make my friend to help me installing this. Thanks for nice stuff.
     
    akbarul, Nov 23, 2011 IP