Jan 28, 2013 10:10 AM
(This post was last modified: Jan 28, 2013 10:29 AM by Gr0wlit.)
Hi all, i'm currently working on a twitter bot, but for some reasons, i can't figure out a working code with webrequest with which i can follow someone.
Currently i can login and store cookies from that action, but then i try to POST a request to
with the exact token and the exact username they require, but i get the error which tells me that my account isn't enabled to do that action. Below the code:
where req is the httpwebrequest and cc is cookiecontainer. Where is the error?
Currently i can login and store cookies from that action, but then i try to POST a request to
Code
https://twitter.com/i/user/followwith the exact token and the exact username they require, but i get the error which tells me that my account isn't enabled to do that action. Below the code:
Code
request = DirectCast(HttpWebRequest.Create("https://twitter.com/i/user/follow"), HttpWebRequest)
Dim Post2 As String = "authenticity_token=" & Token & "&user_id=707602308"
Dim PostData2 As Byte() = Encoding.UTF8.GetBytes(Post2)
With request
.Method = "POST"
.CookieContainer = cc
.UserAgent = "Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20100101 Firefox/14.0.1"
.Accept = "application/json, text/javascript, */*; q=0.01"""
.Referer = "https://twitter.com/Gr0wlit"
.ContentType = "Content-Type: application/x-www-form-urlencoded; charset=UTF-8"
.KeepAlive = True
.ContentLength = PostData2.Length
Dim str As Stream = .GetRequestStream
str.Write(PostData2, 0, PostData2.Length)
str.Close()
End With
res = DirectCast(request.GetResponse, HttpWebResponse)
cc.Add(res.Cookies)
source = New StreamReader(res.GetResponseStream).ReadToEnd
res.Close()where req is the httpwebrequest and cc is cookiecontainer. Where is the error?



