ktsm1809
asked on
How to post a reply to a forum in VB ?
I created this code to post a reply to a forum (I'm testing in IPB) with Visual Basic but when I test , it worked in my localhost , but it not work with other sites and forums .
[CODE]
-------------------------- ---------- ---------- ---------- -------
Private Sub Form_Load()
With Winsock1
.Close
.Connect "testing.com", 80
End With
Private Sub Form_Load()
-------------------------- ---------- ---------- ---------- -------
Private Sub Winsock1_Connect()
Dim strDataToSend As String
strDataToSend = "POST /index.php? HTTP/1.1" & vbCrLf
strDataToSend = strDataToSend & "Host: testing.com" & vbCrLf
strDataToSend = strDataToSend & "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1" & vbCrLf
strDataToSend = strDataToSend & "Accept: text/xml,application/xml,a pplication /xhtml+xml ,text/html ;q=0.9,tex t/plain;q= 0.8,image/ png,*/*;q= 0.5" & vbCrLf
strDataToSend = strDataToSend & "Accept-Language: en-us,en;q=0.5" & vbCrLf
strDataToSend = strDataToSend & "Accept-Encoding: gzip,deflate" & vbCrLf
strDataToSend = strDataToSend & "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q =0.7" & vbCrLf
strDataToSend = strDataToSend & "Keep-Alive: 300" & vbCrLf
strDataToSend = strDataToSend & "Connection: keep-alive" & vbCrLf
strDataToSend = strDataToSend & "Cookie: member_id=1; pass_hash=91ce85d7197b57a7 d3bef570f2 ea4d26;" & vbCrLf
strDataToSend = strDataToSend & "Content-Type: application/x-www-form-url encoded" & vbCrLf
strDataToSend = strDataToSend & "Content-Length: 81" & vbCrLf
strDataToSend = strDataToSend & "act=Post&CODE=03&f=19&t=5 7&auth_key =4eaac715c 8c2ef9c057 290f728590 239&Post=t esting" & vbCrLf
strDataToSend = strDataToSend & vbCrLf
Winsock1.SendData strDataToSend
End Sub
-------------------------- ---------- --------En d of CODE---------------------- ---------
thanx for ur help
[CODE]
--------------------------
Private Sub Form_Load()
With Winsock1
.Close
.Connect "testing.com", 80
End With
Private Sub Form_Load()
--------------------------
Private Sub Winsock1_Connect()
Dim strDataToSend As String
strDataToSend = "POST /index.php? HTTP/1.1" & vbCrLf
strDataToSend = strDataToSend & "Host: testing.com" & vbCrLf
strDataToSend = strDataToSend & "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1" & vbCrLf
strDataToSend = strDataToSend & "Accept: text/xml,application/xml,a
strDataToSend = strDataToSend & "Accept-Language: en-us,en;q=0.5" & vbCrLf
strDataToSend = strDataToSend & "Accept-Encoding: gzip,deflate" & vbCrLf
strDataToSend = strDataToSend & "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q
strDataToSend = strDataToSend & "Keep-Alive: 300" & vbCrLf
strDataToSend = strDataToSend & "Connection: keep-alive" & vbCrLf
strDataToSend = strDataToSend & "Cookie: member_id=1; pass_hash=91ce85d7197b57a7
strDataToSend = strDataToSend & "Content-Type: application/x-www-form-url
strDataToSend = strDataToSend & "Content-Length: 81" & vbCrLf
strDataToSend = strDataToSend & "act=Post&CODE=03&f=19&t=5
strDataToSend = strDataToSend & vbCrLf
Winsock1.SendData strDataToSend
End Sub
--------------------------
thanx for ur help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
[quote]
be changed to:
strDataToSend = strDataToSend & "Content-Length: 81" & vbCrLf & vbcrlf
wow , thanx so much . it work now (a small but important error :D)
be changed to:
strDataToSend = strDataToSend & "Content-Length: 81" & vbCrLf & vbcrlf
wow , thanx so much . it work now (a small but important error :D)
You're welcome:)
As vain as this sounds, I reccommend my own post to be accepted, since ktsm1809 quoted my solution and said it worked...
AtanAsfaloth,
It is not at all vain to point out that you are right when you are, in fact, right :-). I appreciate it when an Expert takes the time to recheck these old questions. Thanks!
-- DanRollins, EE Cleanup Volunteer
It is not at all vain to point out that you are right when you are, in fact, right :-). I appreciate it when an Expert takes the time to recheck these old questions. Thanks!
-- DanRollins, EE Cleanup Volunteer
strDataToSend = strDataToSend & "Host: testing.com" & vbCrLf
would you not have to change this every time you change location?
Leo