HTTPSocket get back URL

When I do a search on with this URL:,+Israel
I got this URL back:,+Israel/@32.7996175,34.9817567,13z/data=!3m1!4b1!4m2!3m1!1s0x151dba4c750de845:0xc35d23982a81529a

How can I get this new created url?

Dim socket1 As New HTTPSocket
Dim data As String = socket1.Get(“,+Israel”, 30)
TextArea1.Text = data


?302 Moved?

302 Moved

?The document has moved?here.????

dim s2 As New HTTPSocket
dim i as new InternetHeaders
i = s2.GetHeaders(“,+Israel”, 30)
TextArea1.Text = i.Source

HTTP/1.0 302 Found??Location:,+Israel??Cache-Control: private??Content-Type: text/html; charset=UTF-8??P3P: CP=“This is not a P3P policy! See for more info.”??Date: Mon, 11 Apr 2016 20:51:59 GMT??Server: gws??Content-Length: 247??X-XSS-Protection: 1; mode=block??X-Frame-Options: SAMEORIGIN??Set-Cookie: NID=78=Uce9WL7bexgFpusbAdAbfhGPAm7lxU4UWxHMMRqgs0Yneien1iZ9zulN84t42rS_ZShp88rw4EiZnK_7SOU3uTxwEYgd0M1CRJlgQl1LmH-dvy_O91IDh2_NKM6TLoYw; expires=Tue, 11-Oct-2016 20:51:59 GMT; path=/;; HttpOnly

You need to handle the Headers:

Code 302 is temporary redirect.

I would personally do it with an object in the IDE and handle the HeadersRecieved event:

In addition to the 302 it appears you have to handle the cookie.

The new framework Xojo.Net.HttpSocket should handle the 301 and 302 location headers by itself.
(Not sure how this works with the cookie on the 302 though.)

Something more than just a Cookie is needed though. In Safari with cookies disabled the url doesn’t load, but trying it in Xojo with the cookie it still doesn’t work.

edit: here’s a really gross workaround :slight_smile: Add an HTMLViewer, load the url, in docComplete send the href to status and get it there

[code]Sub Action()
End Sub

Sub DocumentComplete(URL as String)
me.ExecuteJavaScript(“window.status = window.location.href”)
End Sub

Sub StatusChanged(newStatus as String)
TextArea1.Text = "final url: " + newStatus
End Sub[/code]

Use the google maps api?


{MODE} is one of place, directions, search, view, or streetview.
{YOUR_API_KEY} is your free API key.
parameters include optional parameters, as well as mode-specific parameters.