Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average
Thread Closed 


Askfm httpwebrequest filter_list
Author
Message
Askfm httpwebrequest #1
[code=vbnet]
Private Function GetToken() As String
Dim Token As String = String.Empty
Using Web As New WebClient
Dim source As String = Web.DownloadString(String.Format("http://ask.fm/AlessandroAfo"))
Dim Regex As New Regex("(?=var AUTH_TOKEN).*")
Token = Regex.Matches(source)(0).Value.Replace("var AUTH_TOKEN = """, "").Replace(""";", "")
End Using
Return Token
End Function

Private Function Domanda(ByVal qustion As String) As String
Dim token As String = GetToken()
If String.IsNullOrEmpty(token) Then Throw New Exception("Token vuoto")
Dim data As String = String.Format("authenticity_token={0}&question%5Bquestion_text%5D={1}%3F&question%5Bforce_anonymous%5D=&authenticity_token={0}", token, qustion)
Dim bytes() As Byte = New UTF8Encoding().GetBytes(data)

Dim Request As HttpWebRequest = DirectCast(HttpWebRequest.Create("http://ask.fm/AlessandroAfo/questions/create"), HttpWebRequest)
Request.KeepAlive = True
Request.Method = "POST"
Request.ContentType = "application/x-www-form-urlencoded"
Request.Referer = "http://ask.fm/AlessandroAfo"
Request.UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0"

Request.Headers.Add("Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3")
Request.Host = "ask.fm"

Request.ContentLength = bytes.Length

Using [Stream] As Stream = Request.GetRequestStream
[Stream].Write(bytes, 0, bytes.Length)
End Using

Using Response As HttpWebResponse = Request.GetResponse
Using Stream As Stream = Response.GetResponseStream
Using Reader As New StreamReader(Stream)
Return Reader.ReadToEnd
End Using
End Using
End Using

End Function
[/code]
this is mycode but this is the response
[Image: d54a87af882c51e80358c961c57b47a4.png]
[Image: Eeiygwm.png]
[Image: uiw9M7w.png][Image: Y8ausZK.gif]
[Image: 1uUyOl6.png]


RE: Askfm httpwebrequest #2
This was posted in the wrong section and has been moved. Please be mindful of where you are posting.



What exactly are you trying to do, and what is the problem you are experiencing?


RE: Askfm httpwebrequest #3
thanks
i'm trying to send a question to ask with httpwebrequest but the response must be a html with a text Question sent or similar thing

p.s.: sorry for bad english
(This post was last modified: 08-16-2013, 06:46 PM by 凱文..)
[Image: Eeiygwm.png]
[Image: uiw9M7w.png][Image: Y8ausZK.gif]
[Image: 1uUyOl6.png]


RE: Askfm httpwebrequest #4
I'm sorry, I can't really understand your question. Can you send me an example response you are trying to receive?


RE: Askfm httpwebrequest #5
this:
[Image: 5e48be80f092e53076bb216be9b4eb74.png]
(This post was last modified: 08-16-2013, 06:52 PM by 凱文..)
[Image: Eeiygwm.png]
[Image: uiw9M7w.png][Image: Y8ausZK.gif]
[Image: 1uUyOl6.png]


RE: Askfm httpwebrequest #6
Why is this in PHP discussion? His code is VB.Net.
[Image: CDUAq9d.png]


RE: Askfm httpwebrequest #7
I'll be asking a staff member to move this thread in few seconds.
Don't you mind to look at my user-title?

[Image: w2bzKQY.png?1]



RE: Askfm httpwebrequest #8
i resolve i insert allowredirect Smile how i close?
[Image: Eeiygwm.png]
[Image: uiw9M7w.png][Image: Y8ausZK.gif]
[Image: 1uUyOl6.png]


RE: Askfm httpwebrequest #9
Since you requested a close, this thread is now closed. Smile
[Image: WV5eQ42.jpg]

If you've got any questions regarding c++ or java, feel free to hit me up with a private message at any time.

http://adf.ly/UyTEk








Users browsing this thread: 1 Guest(s)