-
Sep 4th, 2017, 11:20 PM
#1
Thread Starter
New Member
Need Help With VB.NET HttpWebRequest Post...
I am a member of a forum that allows for a BUY/SELL/TRADE section where I'd like to make a couple posts a week. I'd like to use the interface of my VB.NET application to post there.
I learned how to login to a the Rocbattl.com forum which was pretty easy to do. Here is the login string that I found in LiveHttpHeaders:
"http://rocbattle.com/check_login.php?pg=http://rocbattle.com/index.php"
And here is the post string for logging in through this request:
"username=****&password=****&remember=remember&login=: undefined"
But I don't know what to do after I login. I'm trying to create a POST to this section of the forum (BUY/SELL/TRADE): http://rocbattle.com/viewforumrb.php...21fe2c3c92b499
So I guess my question would be; how do I carry the login cookie & submit a new post to the "BUY/SELL/TRADE" section?
HERE IS THE CODE THAT I'M USING SO FAR:
Code:
Imports System.IO
Imports System.Net
Imports System.Text
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim postData As String = "username=" & TextBox1.Text & "&password=" & TextBox2.Text & "&remember=remember&login=: undefined"
Dim tempCookies As New CookieContainer
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://rocbattle.com/check_login.php?pg=http://rocbattle.com/index.php"), HttpWebRequest)
postReq.Method = "POST"
postReq.KeepAlive = True
postReq.CookieContainer = tempCookies
postReq.ContentType = "application/x-www-form-urlencoded"
postReq.Referer = "http://rocbattle.com/check_login.php?pg=http://rocbattle.com/index.php"
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
'Webbrowser show results:
WebBrowser1.DocumentText = thepage
End Sub
Again, the code above successfully logs me in, but I'm not sure how to POST & create a new thread to the following link:
http://rocbattle.com/viewforumrb.php...21fe2c3c92b499
Here is what the POST string looks like according to LiveHTTPHeaders:
subject=MY+SUBJECT&addbbcode20=100&helpbox=Tip%3A+Styles+can+be+applied+quickly+to+selected+text.&me ssage=MY+BODY+MESSAGE%3F&attach_sig=on&lastclick=1504576612&post=Submit&creation_time=1504576612&for m_token=7b51dd142acd764e07f198589e3dc1cc360a8664: undefined
I also noticed that the POST STRING requires the following 3:
lastclick=
creation_time=
form_token=
And I can see that they all exist & are generated on the main thread posting page within the HTML:
http://rocbattle.com/viewforumrb.php...21fe2c3c92b499
How do I extract these values with the HttpWebRequest & POST it to this section of the forum? Thanks for any support.
Last edited by si_the_geek; Sep 5th, 2017 at 10:25 AM.
Reason: removed login details
-
Sep 5th, 2017, 07:19 AM
#2
Re: Need Help With VB.NET HttpWebRequest Post...
The answer is you don't. That's because what you're doing is technically violating their terms & conditions, which violates the Terms of Service & AUP here.
Your Conduct
This Website may be used only for lawful purposes of uploading audio tracks, videos, beats, and information related to the music business. The Company specifically prohibits any use of the Website, and all users agree not to use the Website, for any purposes other than designated by the Company in its sole discretion, including but not limited to:
...
Using or attempting to use any engine, software, tool, agent or other device or mechanism (including without limitation browsers, spiders, robots, avatars or intelligent agents) to navigate or search this Website other than the search engine and search agents available from Company and other generally available third party web browsers.
-tg
-
Sep 5th, 2017, 08:15 AM
#3
Re: Need Help With VB.NET HttpWebRequest Post...
It's also very stupid to post your login credentials on a public forum!
-
Sep 5th, 2017, 10:27 AM
#4
Re: Need Help With VB.NET HttpWebRequest Post...
I'm afraid that as mentioned above, what you are doing is against the terms of rocbattle.com , so asking for assistance is against our terms.
This thread is now closed, please do not create more for similar topics.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|