• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

win http request to login and using live header but dont know decode user

graha_karya

New Member
i have problem i dont know where is user name and pasword i am using live header to record login and url
i want split user dan pasword using textbox but i dont know where is pasword and user
"__user=0&__a=1&__dyn=7xe6FomK36Q5E5ObGexe8BWo5O12wAxu13wqovzEdEc8uw9-3K4o1j8hwem0nCq1ewcG0KEswdC1nwlU-cw5MKdwnU1oU881FU2YxW&__csr=&__req=6&__beoa=0&__pc=PHASED:DEFAULT&dpr=1&__rev=1001652549&__s=7tjb0q:1e86zy:x0q7yk&__hsi=6787310697084200233-0&lsd=AVqgWJtS&jazoest=2727&__spin_r=1001652549&__spin_b=trunk&__spin_t=1580293918"

>>> use code - tags <<<

Code:
Public data As String
Function test(Murl As String, postdata As String)
Dim whttp As New WinHttpRequest
With whttp
.Open "POST", Murl
.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.SetRequestHeader "content-length", Len(postdata)
.Send
'"__user=0&__a=1&__dyn=7xe6FomK36Q5E5ObGexe8BWo5O12wAxu13wqovzEdEc8uw9-3K4o1j8hwem0nCq1ewcG0KEswdC1nwlU-cw5MKdwnU1oU881FU2YxW&__csr=&__req=6&__beoa=0&__pc=PHASED:DEFAULT&dpr=1&__rev=1001652549&__s=7tjb0q:1e86zy:x0q7yk&__hsi=6787310697084200233-0&lsd=AVqgWJtS&jazoest=2727&__spin_r=1001652549&__spin_b=trunk&__spin_t=1580293918"
data = .ResponseText
MsgBox data
End With
End Function

Sub testlog()
test "https://www.facebook.com/?stype=lo&jlou=AfeouWtx7PmHTyMyg6TlVk1v4Aw6zW-IkYth1YXkX9BQklCojtBlhK3pFqokmP7Myg9QmKoIp1PYE_wxAKYnKN98r9ATEcuUOPOPTdrmLKEegw&smuh=24238&lh=Ac98O2GyA3j-iLmQ", _
"__user=0&__a=1&__dyn=7xe6FomK36Q5E5ObGexe8BWo5O12wAxu13wqovzEdEc8uw9-3K4o1j8hwem0nCq1ewcG0KEswdC1nwlU-cw5MKdwnU1oU881FU2YxW&__csr=&__req=6&__beoa=0&__pc=PHASED:DEFAULT&dpr=1&__rev=1001652549&__s=7tjb0q:1e86zy:x0q7yk&__hsi=6787310697084200233-0&lsd=AVqgWJtS&jazoest=2727&__spin_r=1001652549&__spin_b=trunk&__spin_t=1580293918"
End Sub
 
Last edited by a moderator:
You need to use OAuth or OAuth2.0 if I recall.

There are some custom wrappers/class modules written for it.

Try googling "vba OAuth facebook" you should find some samples. But if you are not familiar with it, you may find it easier to manipulate IE via VBA.

I don't have FB account to test with.
 
I am has opten using IE but can not to login in form j query
Actualy i have url is form login
Is very hard to login
Form login must to click button
To show login form

I hope you can solve my problem
 

Attachments

  • Screenshot_2020-01-29-21-49-55-83.png
    Screenshot_2020-01-29-21-49-55-83.png
    207 KB · Views: 4
Do you use developer tool?

The site you gave as example uses Auth token generated when site is opened.

txtPassword & txtUserID are encrypted plain text. When tested, using same string "abc" in both the UserID and Password it generated same encrypted string.

Then using authenticitytoken from the site (you need to scrape this from cookie/response header), construct your Post request string. Replacing txtPassword & txtUserId with actual one (which you need to encrypt).
Code:
authenticityToken=42b037e0c21119e1c087fc0180c2dab5c44fa779&txtPassword=2mU1D2zwEJ3XFd0CGVke%2FQ%3D%3D&txtUserId=2mU1D2zwEJ3XFd0CGVke%2FQ%3D%3D&isRekanan=false&login=

But each site uses different method and same method can't be used. Facebook has API which should be easier to use as it's meant for automation via code.
 
Do you use developer tool?

The site you gave as example uses Auth token generated when site is opened.

txtPassword & txtUserID are encrypted plain text. When tested, using same string "abc" in both the UserID and Password it generated same encrypted string.

Then using authenticitytoken from the site (you need to scrape this from cookie/response header), construct your Post request string. Replacing txtPassword & txtUserId with actual one (which you need to encrypt).
Code:
authenticityToken=42b037e0c21119e1c087fc0180c2dab5c44fa779&txtPassword=2mU1D2zwEJ3XFd0CGVke%2FQ%3D%3D&txtUserId=2mU1D2zwEJ3XFd0CGVke%2FQ%3D%3D&isRekanan=false&login=

But each site uses different method and same method can't be used. Facebook has API which should be easier to use as it's meant for automation via code.
I will be test now
Can you explain me how to
Get this "authenticityToken=42b037e0c21119e1c087fc0180c2dab5c44fa779&txtPassword=2mU1D2zwEJ3XFd0CGVke%2FQ%3D%3D&txtUserId=2mU1D2zwEJ3XFd0CGVke%2FQ%3D%3D&isRekanan=false&login="
This is using tool firebug or ?
 
WHAT Wrong msgbox 403 forbidden
please help i was 3 month can not do import data to excel

>>> use code - tags <<<
Code:
Code: Public data As String
Sub getDATA()
Dim whttp As New WinHttpRequest
Dim postdata As String
postdata = "authenticityToken=06d7902f4d2a7194db508add28b9ed98ccb41a60&txtPassword=0iOkHbc7QJv1CLmV8IWm%2Bw%3D%3D&txtUserId=fz5plvhojlQqFR%2Byb3KfXg%3D%3D&isRekanan=true&login="
With whttp
    .Open "POST", "https://lpse.acehprov.go.id/eproc4/login", postdata
    .SetRequestHeader "Content-Type", "Application / x - www - form - urlencoded"
    .SetRequestHeader "content-length", Len(postdata)
    '.SetRequestHeader "Cookie", "SPSE_SESSION=ad9cfcb245d3657cab1f77cd75c543fe586adc9d-___AT=8cc15d45b47498ef33672b5f6398d08cf00afd00&___TS=1580319215310&___ID=4d17025e-f2ae-4933-935f-853f2fd4eb3a&userId=JUNINAWAN; Max-Age=1800; Expires=Wed, 29 Jan 2020 17:33:35 GMT; Path=/eproc4/;HttpOnly;Secure"
    .Send
      If .Status <> 200 Then
          MsgBox .Status & " - " & .statusText
          Exit Sub
      End If
       ' after login from link [URL unfurl="true"]https://lpse.acehprov.go.id/eproc4/lelang_baru[/URL]
' i want to import table to excel
.Open "GET", "[URL unfurl="true"]https://lpse.acehprov.go.id/eproc4/lelang_baru[/URL]", False
.SetRequestHeader "content-type", "text/html"
.Send
  data = .responseText
MsgBox data
End With
End Sub Code:
 

Attachments

  • scraptdata.xlsm
    17.7 KB · Views: 3
Last edited by a moderator:
WHAT Wrong msgbox 403 forbidden
please help i was 3 month can not do import data to excel

>>> use code - tags <<<
Code:
Code: Public data As String
Sub getDATA()
Dim whttp As New WinHttpRequest
Dim postdata As String
postdata = "authenticityToken=06d7902f4d2a7194db508add28b9ed98ccb41a60&txtPassword=0iOkHbc7QJv1CLmV8IWm%2Bw%3D%3D&txtUserId=fz5plvhojlQqFR%2Byb3KfXg%3D%3D&isRekanan=true&login="
With whttp
    .Open "POST", "https://lpse.acehprov.go.id/eproc4/login", postdata
    .SetRequestHeader "Content-Type", "Application / x - www - form - urlencoded"
    .SetRequestHeader "content-length", Len(postdata)
    '.SetRequestHeader "Cookie", "SPSE_SESSION=ad9cfcb245d3657cab1f77cd75c543fe586adc9d-___AT=8cc15d45b47498ef33672b5f6398d08cf00afd00&___TS=1580319215310&___ID=4d17025e-f2ae-4933-935f-853f2fd4eb3a&userId=JUNINAWAN; Max-Age=1800; Expires=Wed, 29 Jan 2020 17:33:35 GMT; Path=/eproc4/;HttpOnly;Secure"
    .Send
      If .Status <> 200 Then
          MsgBox .Status & " - " & .statusText
          Exit Sub
      End If
       ' after login from link [URL unfurl="true"]https://lpse.acehprov.go.id/eproc4/lelang_baru[/URL]
' i want to import table to excel
.Open "GET", "[URL unfurl="true"]https://lpse.acehprov.go.id/eproc4/lelang_baru[/URL]", False
.SetRequestHeader "content-type", "text/html"
.Send
  data = .responseText
MsgBox data
End With
End Sub Code:


I have same problem, if i get this url and then 403 forbidden. I think this problem is a SPSE_SESSION because every 30 minutes this url is expired... maybe anyone have this solution?
 
Back
Top