#1
  1. Resident Black Hat
    SEO Chat Good Citizen (1000 - 1499 posts)

    Join Date
    Aug 2004
    Location
    Woodstock, GA
    Posts
    1,437
    Rep Power
    20

    Retrieving the search terms from search engine


    I'm trying to write a bit of php that will notice when someone has come from a search engine, take the search term and put it into my meta tags.

    So, if someone went to Google and typed in "black hat", then my meta tags would look like:

    <title>Black Hat</title>
    <meta name="title" content="Black Hat" />
    <meta name="description" content="Everything you wanted to know about Black Hat."/>
    <meta name="keywords" content="Black Hat"/>

    Anyone know how to do this?

    G-Man
  2. #2
  3. No Profile Picture
    Contributing User
    SEO Chat Good Citizen (1000 - 1499 posts)

    Join Date
    Apr 2004
    Posts
    1,179
    Rep Power
    17
    why do you want to do this? This can be done:

    1) have a javascript on your page
    2) the script call a a php script on server to store the search terms in a text file or a database
    3) your page get the meta tags from the text file or database.

    The problem is that your meta tags will e totally out of control
  4. #3
  5. Contributing User
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Sep 2004
    Location
    Europe
    Posts
    304
    Rep Power
    15
    i wonder if this will be worth it at all
    i mean... seriously
  6. #4
  7. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Jul 2005
    Posts
    5
    Rep Power
    0

    heres how


    here it is may need a bit more testing

    PHP Code:
    <?php

    //the page from the search engine
    $referrer $_SERVER['HTTP_REFERER']; 

    if (
    referrer) {

        if     (
    strpos($referrer"google")) { 
            
    $pattern '![?&]q=([^&.]*)!'
        } else if (
    strpos($referrer"msn")) { 
            
    $pattern '![?&]q=([^&.]*)!'
        } else if (
    strpos($referrer"yahoo")) { 
            
    $pattern '![?&]p=([^&.]*)!'
        }


    // Get query string 
    if (preg_match($pattern$referrer$matches)) { 
        
    $term urldecode($matches[1]); 
        }else{
        
    //if the traffic it not reffered from google, yahoo or msn use this term
        
    $term "defult";

     
    ?>
    <html>
    <head>
    <meta name="title" content="<?print $term;?>" />
    <meta name="description" content="Everything you wanted to know about <?print $term;?>."/>
    <meta name="keywords" content="<?print $term;?>"/>
    may i ask why ya what this?
    Last edited by bentho; Jul 7th, 2005 at 11:29 PM.
  8. #5
  9. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Jul 2005
    Posts
    5
    Rep Power
    0

    More questions


    Hi G-man

    may i also ask why you need some one else to write this script i just read your bio at ************************/user_bio_of_gman.php (which is a great site BTW) and you sound like a pretty good programer so why dont ya just whip this **** up in ASP?

    iam not flameing or anything just curious

    Thanks

    Ben
  10. #6
  11. http://tinyurl.com/cz56g
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    D0RDRECHT NL
    Posts
    6,063
    Rep Power
    31
    So, SEOChat is now getting referrals from *********** (or am I jumping to conclusions here) ??? Tsk tsk, what has the world come to?

    BTW - welcome bentho
    ...please help me w/ the real Redscowl Bluesingsky...how2 check backlinks...now postin' @ SEO Refugee ...
    <`)~ LOL now that I finally have a paypal account, I'm charging 19,- for SEO advice via PM. Seriously...
  12. #7
  13. Contributing User
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Mar 2005
    Location
    Sacramento, CA
    Posts
    264
    Rep Power
    15
    Sounds like you're taking a contrarian approach to cloaking. Seems like a pretty safe way to do it, at least for now. But at that point you may as well keep your meta tags empty.
  14. #8
  15. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Jul 2005
    Posts
    5
    Rep Power
    0

    jumping to conclusions


    your jumping to conclusions, ive been around these boards for a whlie just never got around to posting, love the boards they are diffently one of the best seo boards out there!

    Comments on this post

    • Wit agrees : That is true of course :)

Similar Threads

  1. Preview MSN similar to WISENUT SERPs - not so innovative after all
    By -search-engines-web in forum BING/Yahoo Search Optimization
    Replies: 19
    Last Post: Jun 22nd, 2006, 11:20 PM
  2. Search Engine placement
    By gnansunder in forum Suggestions & Feedback
    Replies: 0
    Last Post: Feb 8th, 2005, 01:09 AM
  3. My 100th post
    By craige in forum Search Engine Optimization
    Replies: 7
    Last Post: Jan 6th, 2005, 03:12 AM
  4. SEO FAQs
    By Phoenix in forum SEO Chat FAQs
    Replies: 4
    Last Post: Oct 25th, 2004, 03:05 PM

IMN logo majestic logo threadwatch logo seochat tools logo