visto la richiesta di UNREG ho fatto uno script (molto piccolo e senza nessuna particolare pretesa) per riconoscere la query di ricerca fatta in un motore di ricerca dal quale proviene un utente
nell'esempio potete vedere la funziona che opera sulla variabile passata dal form
solitamente sarà utile usare invece il valore presente nelle server.variables, e in particolare il REFERER
lo trovate attivo qui
http://www.splik.org/waho/unregspiders.asp
ecco lo script
lo trovate attivo quicodice:<% dim referer, found Referer = request.Form("Referer") found = false If referer <> "" Then dim ii dim objRegExp Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True objRegExp.multiline = false dim urlDomain dim urlRobot dim urlSubpage dim urlQuerystring objRegExp.pattern = "^(http:\/\/(?:www\.)?([^\/?]*))([^?]*)(.*$)" if objRegExp.Test(Referer) then 'spezza l'indirizzo nelle varie componenti set Matches = objRegExp.Execute(Referer) urlDomain = Matches(0).SubMatches(0) urlRobotSubdomain = Matches(0).SubMatches(1) urlSubpage = Matches(0).SubMatches(2) urlQuerystring = Matches(0).SubMatches(3) 'cerca fra i robot conosciuti objRegExp.pattern = "(yahoo|lycos|tiscali|excite|altavista|libero|msn|virgilio|google|exalead)" if objRegExp.Test(urlDomain) then set Matches = objRegExp.Execute(Referer) urlRobot = Matches(0).SubMatches(0) else urlRobot = "" end if dim qsPattern, qsQuery 'se il robot è conosciuto ne imposta la QueryString value e ne imposta il nome select case lcase(urlRobot) case "yahoo" qsPattern = "p" robotName = "Yahoo!" case "virgilio" qsPattern = "qs" robotName = "Virgilio" case "tiscali" qsPattern = "key" robotName = "Tiscali" case "libero" qsPattern = "query" robotName = "Arianna/Libero" case "google" qsPattern = "q" robotName = "Google" case "exalead" qsPattern = "q" robotName = "Exalead" case "msn" qsPattern = "q" robotName = "MSN Search" case "altavista" qsPattern = "q" robotName = "Altavista" case "excite" qsPattern = "q" robotName = "Exite" case else qsPattern = "(?:q|qs|p|key|query)" robotName = "Motore non riconosciuto" end select 'ricerca la querystring search value objRegExp.pattern = "(?:\?|&)" & qsPattern & "=($|[^&]+)" if objRegExp.Test(urlQuerystring) then set Matches = objRegExp.Execute(Referer) qsQuery = Matches(0).SubMatches(0) end if found = true end if End If response.write "<h2>risultato:</h2>" if found then response.write "dominio: " & urlDomain & " " response.write "robot dominio: " & urlRobotSubdomain & " " response.write "robot: " & robotName & " " response.write "sottopagina: " & urlSubpage & " " response.write "querystring: " & urlQuerystring & " " response.write "query di ricerca: <span style=""color:red"">" & qsQuery & "</span>" else response.write "non riconosciuto" end if %> <h2>inserisci un referer di un motore di ricerca:</h2> <form id="form1" method="post" action=""> <input name="Referer" type="text" id="Referer" size="60" value="<%=Referer%>"/></p> <input type="submit" name="Submit" value="Invia" /></p> </form> <h2>esempi (la parola cercata è sempre <span style="color:red">splik</span>):</h2> google: http://www.google.it/search?q=splik&...la:it:official yahoo: http://it.search.yahoo.com/search?p=...al&fr=moz2 libero: http://arianna.libero.it/search/abin...mp;x=0&y=0
http://www.splik.org/waho/unregspiders.asp