c = win_Main.txta_WebSrc.Text.NthField("<meta Property=""og:image"" content=", 2).NthField( "/>", 1)
This code gets a image from the web site and works fine
Var ht As New HTTPSecureSocket
Var f As New FolderItem
Var b As Boolean
f = New FolderItem("image.jpg",FolderItem.PathModes.Native, False)
ht.Yield = True
If c <> "" Then b = ht.Get(c, f, 320)
but this code gives me a ‘Request url is not well-formed.’ error
Var ht As New URLConnection
Var f As FolderItem
f = New FolderItem("image.jpg",FolderItem.PathModes.Native, False)
ht.AllowCertificateValidation = False
If c <> "" Then ht.Send("Get", c , f, 320)
What am I missing?
What does the URL in c look like?
https://m.media-amazon.com/images/I/41-SNWJmcYL.SL210.jpg
This works with HTTPSecureSocket and with Safari
Its a image of a audiobook cover
Maybe your parsing code to calculate c is not doing what you expect? This code worked for me and downloaded the image:
Var c As String = "https://m.media-amazon.com/images/I/41-SNWJmcYL.SL210.jpg"
Var f As FolderItem
f = SpecialFolder.Desktop.Child("image.jpg")
Var ht As New URLConnection
ht.AllowCertificateValidation = False
If c <> "" Then ht.Send("GET", c , f, 320)
If you want to match the HTTPSecureSocket code you might want to use SendSync instead:
If c <> "" Then ht.SendSync("GET", c , f, 320)
Your correct, I’ll have to play with c and find out what the problem is.
Maybe it should be “GET” instead of “Get”?
I was wondering about that, too