Google XML with asp not working (but was...!)

Hello Experts,

This page was working fine, however, I now receive an error, which seems to be very strange!

The following link shows the error: https://cws14.my-hosting-panel.com/villas/_admin/searchaddress.asp?address=Kaschechawan PQ Airport (ZKE), Canada&ID=1636

The code of the page is here:

<?xml version="1.0" encoding="ISO-8859-1"?>
<%@LANGUAGE="VBSCRIPT"%>

<%
If Request.QueryString("ID") <> "" then
session("LocationID") = Request.QueryString("ID")
end if
If request.form("searchagain") <> "" then
response.redirect("searchaddress.asp?address=" & request.form("address") & "&ID=" & Session("LocationID"))
end if
  Set objSrvHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
  Set objXMLSend = Server.CreateObject("Msxml2.DOMDocument.6.0")
  Set objXMLReceive = Server.CreateObject("Msxml2.DOMDocument.6.0")

   objXMLSend.async = false
   objXMLSend.loadXML ("*")
   
   url = "http://maps.google.com/maps/api/geocode/xml?address="
   address = request.querystring("address")
   sensor = "&sensor=false"
   url = url & address & sensor
   
   objSrvHTTP.open "GET", url, false
   objSrvHTTP.send (objXMLSend)
   Set objXML = objSrvHTTP.responseXML
   Response.ContentType = "text/xml"
   'Response.Write (objXMLReceive.xml)
   
   If objXML.parseError.errorCode <> 0 Then
	 response.write("Error Found")
   End If

 Set objLst = objXML.getElementsByTagName("*")

j = 0
i = 0
AddressStr = ""
AddStrLinkBack = ""

 For i = 0 to (objLst.length - 1)
	If objLst.item(i).nodeName = "lat" then
	lat = objLst.item(i).text
	end if
	If objLst.item(i).nodeName = "lng" then
	lng = objLst.item(i).text
	end if
    If objLst.item(i).nodeName = "formatted_address" Then
      AddressStr = objLst.item(i).text
	  j = j + 1
	  url = "searchaddress.asp?address=" & objLst.item(i).text
	  AddStrLinkBack = AddStrLinkBack & "<BR>&nbsp;<BR><a href=""" & url & """>" & objLst.item(i).text & " lng: " & lng & " lat: " & lat & "</a>"
    End If
 Next
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-32" />
<title>Searching Address</title>
</head>
<body>
<form name="form1" method="post">
<%
response.write(address & "<BR>")
If j = 1 then
response.redirect("confirmaddress.asp?lng=" & lng & "&lat=" & lat & "&address=" & AddressStr & "&view=" & request.QueryString("view") & "&ID=" & session("LocationID"))
else
	if J = 0 then
	response.write("Sorry - the address you entered could not be found.  Please amend and retry:<BR>&nbsp;<BR><input type=""text"" size=""50"" name=""address"" id=""address"" value=""" & request.querystring("address") & """ /><input type=""submit"" id=""searchagain"" name=""searchagain"" value=""Search Again"" />")
	else
	response.write("The address you requested returned multiple possibilities:<BR>&nbsp;<BR>" & AddStrLinkBack & "If the address is not listed, please try again, perhaps adding in more information:<BR>&nbsp;<BR><input type=""text"" size=""50"" name=""address"" id=""address"" value=""" & request.querystring("address") & """ /><input type=""submit"" id=""searchagain"" name=""searchagain"" value=""Search Again"" />")
	end if
End if
%>
</form>
</body>
</html>

Open in new window


Please help!  Thanks in advance!
Nico2011Asked:
Who is Participating?
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Your link to the sample is using https but the code inside uses http.   Try changing all your links in your code so that https is being used such as

url = "http://maps.google.com/maps/api/geocode/xml?address="

to

url = "https://maps.google.com/maps/api/geocode/xml?address="

Or change your test link to http instead of https.
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Google has change their tos and you may need to register  your application.  code.google.com/apis/console/
0
 
Nico2011Author Commented:
Thanks but it's not that - I've just been through their documentation.

I did however find the problem, which is that it doesn't like running through SSL!  If I switch SSL off for that page, it runs fine!
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Nico2011Author Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for Nico2011's comment #a38334071

for the following reason:

I found the solution as I realised that the difference was that the new page was running under SSL
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Or change your test link to http instead of https.
Not running under ssl was my suggestion.
0
 
Nico2011Author Commented:
We must have been writing the same solution at the same time - your second solution is correct, but I didn't see it when I closed the question - not sure how that happened.

How can I post the points to you please?
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
I'm not sure. If you don't see it on this thread, maybe request attention.
0
 
Nico2011Author Commented:
Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.