Forum Moderators: coopster
In my code I have an array for SEs, and I do it in this way:
"google" => "q:G"
"yahoo" => "p:Y"
By a fairly small exercise, the referring URL gets extracted from $_SERVER['HTTP_REFERER'], compared to what’s in the array, and it goes from there.
As an output, I’ll have that G for Google, Y for Yahoo and so on. I put it wherever I want, pass it through, right it into a file, whatever.
I also have a part that checks on SEs I don’t have on the list (in the array). If that is the case, I get their URL passed through. That way, I can go to that SE, check how they mark their query string and add it into my code.
Finally, in some cases I came across those that do not use the form “q=KEYWORD” but .../q/KEYWORD/...
How do I extract it from there? I don’t feel I could put it into array straight from $_SERVER['HTTP_REFERER'] like I do with Google or any other that is using the form KEY=VALUE.
What do you do in this case? Or what is your suggestion?
Thanks
Test the engine to see how they encode spaces and non-alphanumeric characters - they probably become _ or - and so you should do a quick str_replace() to substitute _ or - to ' ' before writing to your log.