Domino Code Fragment

Code Name*
Searching the Web
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.217.144.32
Description*
Searching the Web
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Exercise Title : Searching the Web

Where : Agent in the R&D database

Solution :

Sub Initialize
   
    Dim s As New notessession
    Dim db As notesdatabase
    Set db = s.currentdatabase
    Dim doc As notesdocument
    Dim url As String
    Dim query As String
   
    '-- Get the current stock quote for IBM corporation
    url = "
http://quote.yahoo.com/quotes?SYMBOLS=IBM&detailed=t"
   
    '- Get the page
    Set doc = db.getdocumentbyurl(url,True)
   
    '-- Get the body
    t = doc.getitemvalue("$body")
   
    '-- Find where the "Last Trade" string appears
    l = Instr(t, "Last Trade")
   
    '-- Extract the quote from the body and show the user
    Messagebox(Mid(t,l,29))
   
    '-- Let's try a query
    query = Inputbox("Enter a one word Yahoo query")
   
    '-- Put the query in Yahoo format
    url="
http://av.yahoo.com/bin/query?p=" + query + "&hc=0&hs=0"
   
    '-- Get the page
    Set doc = db.getdocumentbyurl(url,True)
   
End Sub