So I have sent close to two hours searching for an answer but nothing is working. I need to to send a few cookies through my webbrowser object but for some reason the cookies aren’t being read by my PHP file:
<?php die('Your username is '.$_COOKIE['user']); ?>
And my VB code to send the cookies:
For i = 0 To 4
uploadBoxes(i).Navigate("about:blank")
uploadBoxes(i).Document.Cookie = "user=" & username.Text
uploadBoxes(i).Navigate("http://*****/uploader/app.php")
Next i
Again, any help would be appreciated and yes, I do need to send it over the webbrowser object. I also have browsed through MSDN database and even that has shed little light on this problem.
—————————————— THE ANSWER ————————————————-
So I took the InternetSetCookie method and came up with this code that worked on making the cookies:
Imports System.Runtime.InteropServices
' No more data is available.
Const ERROR_NO_MORE_ITEMS = 259
' The data area passed to a system call is too small.
Const ERROR_INSUFFICIENT_BUFFER = 122
Private Declare Function InternetSetCookie Lib "wininet.dll" _
Alias "InternetSetCookieA" _
(ByVal lpszUrlName As String, _
ByVal lpszCookieName As String, _
ByVal lpszCookieData As String) As Boolean
Private sub something()
Dim bRet As Boolean
bRet = InternetSetCookie("http://*****/uploader/app.php", _
"user", "admin")
If bRet = False Then
MsgBox("Failed")
End If
uploadBoxes(i).Navigate("http:/*****/uploader/app.php")
End sub
http://pinvoke.net/default.aspx/wininet.InternetSetCookie