Guest User

Untitled

a guest
Jan 24th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. Func GetCookies($headers,$test = 0)
  2. $splitcookie = StringSplit($headers,"Set-Cookie:",1)
  3. If $splitcookie[0] = 1 then
  4. If $DebugMode = 1 or $DebugMode = 2 Then _ArrayAdd($ErrorLog,"Error in Function:'"&$DebugModeCurrentFunction&"' Cannnot GetCookies:"&@CRLF&$headers&@CRLF)
  5. Return "error"
  6.  
  7. EndIf
  8. if $test = 1 then
  9. ;;msgbox(0,"full headers",$headers)
  10. for $i = 1 to $splitcookie[0]
  11. ; ;msgbox(0,"cookie test "&$i,$splitcookie[$i])
  12. Next
  13. EndIf
  14. dim $cookie[$splitcookie[0]-1],$grabcookies
  15. $e = 0
  16. for $i = 1 to $splitcookie[0]
  17. If $i <> 1 and $i <> $splitcookie[0] then
  18. $cleancookie = StringSplit($splitcookie[$i],";",1)
  19. $cookie[$e] = $cleancookie[1]
  20.  
  21. $e = $e + 1
  22. EndIf
  23. If $i = $splitcookie[0] Then
  24. $splitlast = StringSplit($splitcookie[$splitcookie[0]],";",1)
  25. $cleancookie = StringSplit($splitlast[1],";",1)
  26. $cookie[$e] = $cleancookie[1]
  27. $e = $e + 1
  28. EndIf
  29. Next
  30.  
  31. for $i = 0 to UBound($cookie)-1
  32. $GRABcookies = $GRABcookies & "; "&$cookie[$i]
  33. Next
  34.  
  35. $GRABcookies = StringTrimleft($GRABcookies,3)
  36. Return $GRABcookies & ";"
  37. EndFunc
Add Comment
Please, Sign In to add comment