Status
Not open for further replies.

g1iore3y87

Active Member
159
2012
46
0
i try to remote upload using imgur but not work please help me

this my code

Code:
 Dim hRequest As HttpWebRequest = TryCast(WebRequest.Create("https://imgur.com/upload?url=" & TextBox2.Text), HttpWebRequest)
        hRequest.KeepAlive = False
        hRequest.ProtocolVersion = HttpVersion.Version10
        hRequest.UserAgent = _
         "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11"

        Dim reader As New StreamReader(hRequest.GetResponse().GetResponseStream())
        Dim res As String = reader.ReadToEnd()
        TextBox2.Text = res
        reader.Close()

my error are -
fZ2Lq.png
 
2 comments
You are getting that error because you are requesting a https secured link. You would have to attach a handler at ServicePointManager.ServerCertificateValidationCallback or use a http version

Also, for such simple tasks, you could simply use WebClient, wrapper for HTTPWebRequest

PHP:
        Dim imageURL As String = "http://i51.fastpic*****big/2013/0110/7f/84b913cd86bfaf2463be9a404a45ec7f.jpg"

        Using wc As New WebClient()
            Dim res As String = wc.DownloadString(String.Format("https://imgur.com/upload?url={0}", Uri.EscapeUriString(imageURL)))
            ' Your other task here
        End Using

Always escape the data before you send it in a get or post request
 
Status
Not open for further replies.
Back
Top