% Option Explicit %>
<%
Dim RapidDosya
RapidDosya=Request.Form("Arayalim")
%>
RapidSahre Dosya Veritabanư
<%
Dim GoogleAPILisans, SiteAdresi, MakCikti
Dim SorguAtla, AramaDegisken, Baslangic
GoogleAPILisans = "XhpShwtQFHL03W/dTOg3iw6r9MFjYMD4"
SiteAdresi = RapidDosya & " site:.rapidshare.com"
If Request.QueryString("Arayalim") <> "" Then
If Request.QueryString("MakCikti") <> "" Then
MakCikti = request.QueryString("MakCikti")
Else
MakCikti = 10
End If
AramaDegisken = Request.QueryString("Arayalim")
If InStr(1, AramaDegisken, SiteAdresi, 1) = 0 Then
SorguAtla = AramaDegisken
AramaDegisken = AramaDegisken + SiteAdresi
Else
SorguAtla = Replace(AramaDegisken, SiteAdresi, "")
End if
If Request.QueryString("Baslangic") = "" Then
Baslangic = -1
Else
Baslangic = Request.QueryString("Baslangic")
End If
End If
%>
<%
If Request.QueryString("Arayalim") <> "" Then
Call GetResults()
Else
%>
<% End If %>
<%
Private sub GetResults()
Dim objInputXMLDoc, objXMLHTTP, xmlDoc, xslDoc
Set objInputXMLDoc = Server.CreateObject("Microsoft.XMLDOM")
objInputXMLDoc.load Server.MapPath("doGoogleSearch.xml")
objInputXMLDoc.selectSingleNode("//key").Text = GoogleAPILisans
objInputXMLDoc.selectSingleNode("//q").Text = AramaDegisken
objInputXMLDoc.selectSingleNode("//start").Text = Baslangic
objInputXMLDoc.selectSingleNode("//maxResults").Text = MakCikti
Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.open "post", "http://api.google.com/search/beta2", False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml"
objXMLHTTP.setRequestHeader "SOAPAction", "doGoogleSearch"
objXMLHTTP.send objInputXMLDoc
set xmlDoc=server.createObject("Msxml2.FreeThreadedDOMDocument.3.0")
xmldoc.async = true
xmlDoc.loadxml objXMLHTTP.responsetext
'TODO: Need to replace s with ...
'For Each node in xmlDoc.
' response.Write node.nodevalue'replace(node., " ", " ")
'Next
If (xmlDoc.parseError.errorCode <> 0) then
Response.Write "XML error - " & " "
Response.Write "Error Reason: " & xmlDoc.parseError.reason & " "
Response.Write "Source: " & xmlDoc.parseError.srcText & " "
Response.Write "Error Line: " & xmlDoc.parseError.line & " "
Response.Write "Error Position: " & xmlDoc.parseError.linepos & " "
Response.End
end if
set xslDoc=server.createObject("Msxml2.FreeThreadedDOMDocument.3.0")
xslDoc.async = false
xslDoc.load server.mapPath("google.xsl")
if (xslDoc.parseError.errorCode <> 0) then
Response.Write "XSL error - " & " "
Response.Write "Error Reason: " & xslDoc.parseError.reason & " "
Response.Write "Source: " & xslDoc.parseError.srcText & " "
Response.Write "Error Line: " & xslDoc.parseError.line & " "
Response.Write "Error Position: " & xslDoc.parseError.linepos & " "
Response.End
end if
// now for the magic of xml/xsl transfomation...
response.write xmlDoc.transformNode(xslDoc)
set xmlDoc = nothing
set xslDoc = nothing
End Sub
%>