greenway

I am trying to pull the keywords used by search engines to find my webpages.

This is the

php

  I am using:


function getkeywords($thereferrer){
$searchengines=Array("search.yahoo p", "google q", "altavista q", "alltheweb q", "search.msn q");
for($i=0;$i<count($searchengines);$i++){
$currsearch=split(" ", $searchengines[$i]);
if(strpos($thereferrer, $currsearch[0])!=false){
$searchqueries=split("&", split("?", $thereferrer[1]));
break;
}
}
if($searchqueries){
for($i=0;$i<count($searchqueries);$i++){
if($searchqueries[$i][0]==$currsearch[1]){
$thekeywords=join(", ", split(" ", urldecode($searchqueries[$i][1])));
break;
}
}
  }
return $thekeywords;
}





if($referrerpage!=""Applause $keywords=getkeywords($referrerpage);
else $keywords="Not Available";


I am inserting a .js file in the footer to pull the info and keeping the log results in a text file.

The .js file is working fine and I am getting results but not any keywords used ?

greenway

Sorry mods just noticed this is in the code repository section.

PLEASE MOVE POST FOR ME  Applause

Bompa

quote author=greenway link=topic=142.msg766#msg766 date=1177879994

The .js file is working fine and I am getting results but not any keywords used ?


I wonder what results you are getting?

I can't help you with

php

 , but what i would do with

perl

  is *first* just save the
referer string to a text file.

Then I could practice parsing the keywords offline and when I get that going, I could add that code.

that's just me,
Bompa

thedarkness

I agree with Bomps' approach.

On a

PHP

  level I would also be inclined to print_r($searchqueries) just before the;
if($searchqueries){
line and see what you've got.

Cheers,
td

greenway

quote author=thedarkness link=topic=142.msg773#msg773 date=1177935357

I agree with Bomps' approach.

On a

PHP

  level I would also be inclined to print_r($searchqueries) just before the;
if($searchqueries){
line and see what you've got.

Cheers,
td


A blank page  Applause

thedarkness

that means your $searchqueries variable is not being set.

Change;
$currsearch=split(" ", $searchengines[$i]);

to;
$currsearch=split(" ", $searchengines[$i]);
print_r( $currsearch );

Cheers,
td


Perkiset's Place Home   Politics @ Perkiset's