Link to home
Create AccountLog in
Visual Basic Classic

Visual Basic Classic

--

Questions

--

Followers

Top Experts

Avatar of sk33v3
sk33v3

INET vs Winsock
I have 2 pieces of code that do the smae thing but one uses the winsock control and the other uses the inet control. The one using the inet control works and the one that uses the winsock control... Any ideas?

here is the Winsock Code

Dim StrPostData As String
    StrPostData = "Username=testingskeeve&Password=testing&charset=iso-8859-1" & _
                           "&siteId=nscpenusmail&newSN=0&mcState=initialized" & _
                           "&authLev=2&submitSwitch=1&triedAimAuth=y" & vbCrLf '' https://my.screenname.aol.com
    StrPostData = "POST /_cqr/login/login.psp" & vbCrLf & "Referer: http://my.screenname.aol.com/_cqr/login/login.psp?siteId=nscpenusmail&authLev=2&mcState=initialized&triedAimAuth=y" & vbCrLf & _
                      "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*" & vbCrLf & _
                      "Content-Length: " & Len(StrPostData) & vbCrLf & vbCrLf & StrPostData
    Debug.Print StrPostData
    MyWinsock.Send StrPostData



Here is the inet code


strPostData = "Username=testingskeeve&Password=testing&charset=iso-8859-1" & _
                  "&siteState=&siteId=nscpenusmail&newSN=0&mcState=initialized" & _
                  "&authLev=2&submitSwitch=1&triedAimAuth=y" & vbCrLf
    'prepare teh header string
    strHeader = "Content-Type: application/x-www-form-urlencoded" & vbCrLf
    'open the url
    Inet1.Execute "http://my.screenname.aol.com/_cqr/login/login.psp", "POST", strPostData, strHeader

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of Kalimac55Kalimac55🇫🇷

You are aware you are overriding you're old StrPostData in the Winsock code?

Avatar of sk33v3sk33v3

ASKER

Yes if if you look at the very end it appends the old value to the new value.

Avatar of CyrexCore2kCyrexCore2k🇺🇸

Try putting a content-type header in there. I can see you have it on the Inet but not on the winsock...

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of sk33v3sk33v3

ASKER

Nope, still not working....

Avatar of CyrexCore2kCyrexCore2k🇺🇸

strPostData = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*" & vbCrLf & _
              "Content-Type: application/x-www-form-urlencoded" & vbCrLf & _
              "User-Agent: Microsoft URL Control - 6.00.8196" & vbCrLf & _
              "Host: my.screenname.aol.com" & vbCrLf & _
              "Content-Length: " & Len(strPostData) & vbCrLf & _
              "Cache-Control: no-cache" & vbCrLf & _
              vbCrLf & _
              strPostData & vbCrLf

If that doesn't work it must be the cookies. the WinInet control automatically sends/(sets?) cookies for you. If you use the winsock control you'll have th grab the cookies manually.

Avatar of CyrexCore2kCyrexCore2k🇺🇸

Might've been a little unclear:

- Code -
Dim StrPostData As String
StrPostData = "Username=testingskeeve&Password=testing&charset=iso-8859-1" & _
                       "&siteId=nscpenusmail&newSN=0&mcState=initialized" & _
                       "&authLev=2&submitSwitch=1&triedAimAuth=y"

strPostData = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*" & vbCrLf & _
             "Content-Type: application/x-www-form-urlencoded" & vbCrLf & _
             "User-Agent: Microsoft URL Control - 6.00.8196" & vbCrLf & _
             "Host: my.screenname.aol.com" & vbCrLf & _
             "Content-Length: " & Len(strPostData) & vbCrLf & _
             "Cache-Control: no-cache" & vbCrLf & _
             vbCrLf & _
             strPostData & vbCrLf
- End Code -

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of sk33v3sk33v3

ASKER

Nope still doesn't work... It says that a variable that I sent it is missing.

Avatar of sk33v3sk33v3

ASKER

It was a problem with the url for some reason they are requesting the SiteID twice. I am going to request a refund in points.

Avatar of sk33v3sk33v3

ASKER

Ok wait, how do you support cookies with Winsock?

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


ASKER CERTIFIED SOLUTION
Avatar of CyrexCore2kCyrexCore2k🇺🇸

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of sk33v3sk33v3

ASKER

The problem is that I am not even receiving tha command through Winsock. I am not receiving any Cookie Commands.

Avatar of sk33v3sk33v3

ASKER

The problem is that I am not even receiving tha command through Winsock. I am not receiving any Cookie Commands.

Avatar of CyrexCore2kCyrexCore2k🇺🇸

True because that particular page isn't where the cookie is coming from. You would need to learn a little bit more about AIM auth to figure out which page sets that cookie.

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.

Visual Basic Classic

Visual Basic Classic

--

Questions

--

Followers

Top Experts

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.