HTMLViewer and source code ... redirect?

Not sure what is going on here. Why does this code not work for xojo.com?

Instead of getting the source code which I can view in my browser, this is returning :

“??301 Moved Permanently??

Moved Permanently

?

The document has moved here.

??” telling me the document has moved to the page I’m dl’ing from??

TextField1.Text = “https://www.xojo.com/

[code]dim s,uri as string
uri=TextField1.Text
dim h as new HTTPSocket
s=h.Get(uri,90)
TextArea1.Text = s

Dim url As String = tf_uri.Text
HtmlViewer1.LoadURL(url)[/code]

To clarify:

The problem is that the string returned is NOT the source code for the page, but a 301 redirect warning. I plugged in the defineencoding just to check, but now I simply get a cleaner version:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://www.xojo.com/">here</a>.</p>
</body></html>

Which of course is not the source code to the xojo home page, which should begin like this:

[code]

Xojo: Cross-platform App Development Tool [/code]

I’m not sure what’s going on…

Hi Dave,

Try using HTTPSecureSocket or Xojo.Net.HTTPSocket instead.

Javier

Okay, I’ve subclassed the HTTPSecureSocket, but must be missing a step as now I’m getting back a bad request:

[code]

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

[/code]

Here’s my code:

[code]dim s,uri as String
uri=tf_uri.Text

// I get the above if this next line is commented out. If I have it active, then nothing returns in the pagereceived event.
fcthis1.Secure = True

fcthis1.Get(uri)
HtmlViewer1.LoadURL(uri)[/code]

fcthis1 is a subclassed HTTPSecureSocket and this is the code in the PageReceived event:

TextArea1.Text = defineencoding(content, encodings.utf8)

Bizarrely, the above now works. Perhaps there was cache at the ISP, I dunno.

Well, first you may need to define encoding for your returned string to get the new lines correctly displayed.
And second you need to follow redirect.

Our CURLSMBS class can be configured to do this…