Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Google API

    I have the following code for a search engine in our website. The search engine
    work just fine but only returns 10 results. I want to modify the code to give
    me a navigation just like google after 10 returns (page 1 of 200) and be able
    to have the option to search the web or our website using the GOOGLE API.

    <%
    Google_Web_APIs_license_key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

    If Request.Form("searchstring") = "" Then
    Search_String = ""
    Else
    Search_String = Request.Form("searchstring")
    End If
    '
    ' This SOAP message came from the Google API soap-examples.
    ' Dump the SOAP message into an XML document and set the key value,
    ' search string value and start index.
    '
    Set objInputXMLDoc = Server.CreateObject("Microsoft.XMLDOM")
    objInputXMLDoc.load Server.MapPath("google/doGoogleSearch.xml")
    objInputXMLDoc.selectSingleNode("//key").Text = Google_Web_APIs_license_key
    objInputXMLDoc.selectSingleNode("//q").Text = Search_String
    objInputXMLDoc.selectSingleNode("//safeSearch").Text = Search_String
    objInputXMLDoc.selectSingleNode("//start").Text = 1
    '
    ' Post the SOAP message.
    '
    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
    'showXML(objXMLHTTP.responseText)
    '
    ' Dump the results into an XML document.
    '
    Set objOutputXMLDoc = Server.CreateObject("Microsoft.XMLDOM")
    objOutputXMLDoc.loadXML objXMLHTTP.responseText
    '
    ' Parse the XML document.
    '
    Set Nodes = objOutputXMLDoc.selectNodes("//item")
    For Each Node In Nodes
    Response.Write "<a href=""" & Node.selectSingleNode("URL").Text & """>" &
    Node.selectSingleNode("title").Text & "</a><br>"
    Response.Write Node.selectSingleNode("snippet").Text & "<BR>"
    Response.Write "<font color=green>" & Node.selectSingleNode("URL").Text &
    "</font>"
    Response.Write "<font color=green>"" - " &
    Node.selectSingleNode("cachedSize").Text & "</font>"
    Response.Write "<BR>"
    Response.Write "<BR>"
    Next
    %>
    <%
    Function showXML(XMLSource)
    Response.Clear
    Response.Write XMLSource
    Response.End
    End Function
    %>

    FLEQUE Guest

  2. Similar Questions and Discussions

    1. Google Adsense
      How do I add the AdSense code using Contribute v2.0?
    2. Google groups
      Hi Why am I not able to finde this newsgroup in Google Groups Henning
    3. Google FYI
      http://www.geek.com/news/geeknews/2006Jan/gee20060202034550.htm Have Fun!
    4. PHP<->Google?
      I'm so curious to know whether Google uses PHP or not. Some pages on the net says that Google uses PHP. Is it true? If so, what database they use?...
    5. Google is not my friend
      Wadda we have now, probably a few million OSX users world-wide. And yet, just try to find a half-ways descent router to use with OSX. I tried...
  3. #2

    Default Re: Google API

    I've an article on how to do this in ASP.NET and Dreamweaver

    [url]http://www.charon.co.uk/content.aspx?CategoryID=30&ArticleID=55[/url]

    --
    Jules
    [url]http://www.charon.co.uk/charoncart[/url]
    Charon Cart 3
    Shopping Cart Extension for Dreamweaver MX/MX 2004



    Julian Roberts Guest

  4. #3

    Default Re: Google API

    I'm using ASP/VBSCRIPT. Is there a way to modify my excisting code to work with
    a navigation?

    <%
    Google_Web_APIs_license_key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

    If Request.Form("searchstring") = "" Then
    Search_String = ""
    Else
    Search_String = Request.Form("searchstring")
    End If
    '
    ' This SOAP message came from the Google API soap-examples.
    ' Dump the SOAP message into an XML document and set the key value,
    ' search string value and start index.
    '
    Set objInputXMLDoc = Server.CreateObject("Microsoft.XMLDOM")
    objInputXMLDoc.load Server.MapPath("google/doGoogleSearch.xml")
    objInputXMLDoc.selectSingleNode("//key").Text = Google_Web_APIs_license_key
    objInputXMLDoc.selectSingleNode("//q").Text = Search_String
    objInputXMLDoc.selectSingleNode("//safeSearch").Text = Search_String
    objInputXMLDoc.selectSingleNode("//start").Text = 1
    '
    ' Post the SOAP message.
    '
    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
    'showXML(objXMLHTTP.responseText)
    '
    ' Dump the results into an XML document.
    '
    Set objOutputXMLDoc = Server.CreateObject("Microsoft.XMLDOM")
    objOutputXMLDoc.loadXML objXMLHTTP.responseText
    '
    ' Parse the XML document.
    '
    Set Nodes = objOutputXMLDoc.selectNodes("//item")
    For Each Node In Nodes
    Response.Write "<a href=""" & Node.selectSingleNode("URL").Text & """>" &
    Node.selectSingleNode("title").Text & "</a><br>"
    Response.Write Node.selectSingleNode("snippet").Text & "<BR>"
    Response.Write "<font color=green>" & Node.selectSingleNode("URL").Text &
    "</font>"
    Response.Write "<font color=green>"" - " &
    Node.selectSingleNode("cachedSize").Text & "</font>"
    Response.Write "<BR>"
    Response.Write "<BR>"
    Next
    %>
    <%
    Function showXML(XMLSource)
    Response.Clear
    Response.Write XMLSource
    Response.End
    End Function
    %>

    FLEQUE Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139