Uentil 0 Posted August 21, 2008 Start a new project, make a Winsock component names "Sck", a button named "cmdConnect", and a button named "cmdDisconnect". All of the HTML sent back will show up in the immediate window. Private Sub cmdConnect_Click() Sck.Close Sck.Connect "www.google.com", 80 End Sub Private Sub cmdDisconnect_Click() Sck.Close End Sub Private Sub Sck_Close() Debug.Print "Closed" End Sub Private Sub Sck_Connect() Debug.Print "Connected" Sck.SendData (SendHeaders) Debug.Print "sending headers" End Sub Private Sub Sck_DataArrival(ByVal bytesTotal As Long) Debug.Print "Data Arrival" Sck.GetData SckData, vbString Debug.Print SckData End Sub Function SendHeaders() SendHeaders = SendHeaders & "GET / HTTP/1.1" & vbCrLf SendHeaders = SendHeaders & "Host: www.google.com" & vbCrLf SendHeaders = SendHeaders & "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7" & vbCrLf SendHeaders = SendHeaders & "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" & vbCrLf SendHeaders = SendHeaders & "Accept-Language: en-us,en;q=0.5" & vbCrLf SendHeaders = SendHeaders & "Accept -Encoding: gzip , deflate" & vbCrLf SendHeaders = SendHeaders & "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" & vbCrLf SendHeaders = SendHeaders & "Keep-Alive: 300" & vbCrLf SendHeaders = SendHeaders & "Connection: keep -alive" & vbCrLf SendHeaders = SendHeaders & "Cache -Control: Max -age = 0" & vbCrLf & vbCrLf End Function Private Sub Sck_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean) Debug.Print Description End Sub Share this post Link to post
rockage 0 Posted August 21, 2008 ANice introduction into winsock, easier to use a HTTPWrapper control though. Share this post Link to post
Union1 33 Posted August 21, 2008 lol ur gona be telling everybody how to use VB? Share this post Link to post
ViperSRT3g 224 Posted August 21, 2008 Well, why not, he's helped me with VB stuff before, I'd recommend him for it. Share this post Link to post
Union1 33 Posted August 21, 2008 ok its just kinda weird every 3rd topic is about vb Share this post Link to post
Uentil 0 Posted August 21, 2008 rockage, winsock lets you send more specific packets, like if you wanted to change cookies and stuff, like for the stickam adder, i had to change cookies and referers alot, and i also had to read them. HTTPWrapper is good if you just want to grab a single page for something. Union1, I'm just sharing my knowledge that i know people would use later, or even that i use alot. Alot of the stuff im posting is used alot when you get into VB6. Share this post Link to post
rockage 0 Posted August 21, 2008 With HTTPWrapper you can change referrers and cookies as well :o Share this post Link to post
rockage 0 Posted August 22, 2008 Could you write a login for gmail for me ? Function is fine but it can just be in a command sub. txtUser.text = username txtPass.text = password I'm not familiar with winsock and cannot access https sites (ex. gmail) with httpwrapper. Share this post Link to post
MadMatt 0 Posted August 22, 2008 wow that was japanese to me :D but i actully kinda sorta wanna learn it :) what programs do i need?? and what it do? Share this post Link to post
Zander 85 Posted August 22, 2008 to bad .net doesnt use that component anymore... Share this post Link to post
Uentil 0 Posted August 22, 2008 Rockage - Logins take too long and i think google uses handshakes that i dont have time to figure out. MadMatt - Download Visual Basic 6 (Hint, it's not free ;]) Share this post Link to post
Mudkiepz 81 Posted August 22, 2008 w 0 0 t? isnt vb6 free? i got it for free :D Share this post Link to post