
![]() |
greenway
I am trying to pull the keywords used by search engines to find my webpages.
This is the phpI 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!="" ![]() 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 ![]() 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 withperlis *first* just save thereferer 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 PHPlevel 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 PHPlevel 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 ![]() 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 |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads