I'm trying to make a github OAuth but it needs some post and get responses. so how can I make a get request to a specific url an then get the response in form of json, this is the code that I tried:
Dim logincookie As CookieContainer
Dim rqtp As Integer
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create(TextBox1.Text), HttpWebRequest)
Dim postData As String = TextBox1.Text
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim tempCookies As New CookieContainer
postReq.Method = "GET"
postReq.KeepAlive = True
postReq.CookieContainer = tempCookies
postReq.ContentType = "application/xml"
postReq.Referer = TextBox1.Text
postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
postReq.ContentLength = byteData.Length
Dim postreqstream As Stream = postReq.GetRequestStream()
postreqstream.Write(byteData, 0, byteData.Length)
postreqstream.Close()
Dim postresponse As HttpWebResponse
postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
tempCookies.Add(postresponse.Cookies)
logincookie = tempCookies
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
response.Text = thepage
Clipboard.Clear()
Clipboard.SetText(thepage)
MsgBox(thepage, vbInformation + vbOK, "result")
also if you want you can see the repo so you can see the ful project :)