473,397 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Google API - sporadic success

Hi! I'm trying to get some help implementing a classic ASP version of
the Google API search (http://www.google.com/apis/). I've got a version
that works, but it's very sporadic. Sometimes it works, sometimes it
comes back blank, sometimes it gives an error. No other ASP version of
this API has any problems.

Dim Google_Web_APIs_license_key, Search_String
Google_Web_APIs_license_key = "HIDDEN"
Search_String = Request("q")
If Search_String = "" Then
Search_String = "transformers"
End If
'
' The SOAP message (doGoogleSearch.xml) was downloaded 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("doGoogleSearch.xml")
objInputXMLDoc.selectSingleNode("//key").Text =
Google_Web_APIs_license_key
objInputXMLDoc.selectSingleNode("//q").Text = Search_String
objInputXMLDoc.selectSingleNode("//start").Text = 0
'
' 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>
" & VbCrLf
'Response.Write Node.selectSingleNode("snippet").Text & "

" & VbCrLf
Next

Function showXML(XMLSource)
Response.Clear
Response.Write XMLSource
Response.End
End Function

The page is at http://www.botchthecrab.com/searchNew2.asp
By default it searches for "transformers", but you can change the
search parameter like so:
http://www.botchthecrab.com/searchNew2.asp?q=football

You have to reload a few times to get all the desired results, but I
guarantee it works sometimes and sometimes not.

Any help would be appreciated!

~ Botch

Mar 16 '06 #1
0 1197

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bob Murdoch | last post by:
I'm receiving a sporadic error: "The remote procedure call failed and did not execute", when calling the following page: <%@ language="JavaScript" %> <% var vPath =...
87
by: ziliath | last post by:
I recently tried out the Google "top coder" contest, as a C++ coder. I noticed immediately that they expected me to know STL. To which I say, what the fuck?! I may be missing something, but at...
0
by: Ike | last post by:
I have an Activex Control created in VB6, which, displays no problem on any machine I have, but, on some machines of others, it does not. All machines are running either XP or Windows 2000, and all...
0
by: Victor Alcazar | last post by:
Our ASP.NET (VB) is generating sporadic "Unable to validate data" and "Invalid length for a Base-64 char array" errors. The production environment is two Windows 2000 Advanced Servers in a web...
3
by: sameer | last post by:
Hi All, i have an asp.net application which has got sql server 2000 behind the scenes. Very simple application, all it does is extract the data from the databse and display it in the grid. But...
0
by: Petemo94 | last post by:
Folks, I am getting a "sporadic" exception that contains the following stack trace. I say sporadic b/c my DB connection usually works fine, but occasionally it fails. *** I also noted that...
3
by: christopher.davidson | last post by:
Hello, I am working with XML files and utilizing Array functions to take the XML data and combined it with some html code to display a particular page. The process currently works like so: ...
3
by: Michel Couche | last post by:
Hello, I have an ASP.Net application that uses the Wizard control to build a newsletter. There are three steps in the wizard. The customer's specific design data are loaded from a database in...
3
by: Daniel Rindt | last post by:
Hello List, i hope to find an answer here, my problem is that my Webserver sporadic offers php scripts for download. I search with google and find some issues belonging to php version 4.x and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.