First I use
ClearCookies[All];
ck = URLRead @ HTTPRequest["https://wolfram.com",CookieFunction->Print]
to get an example of cookies. Then I save the cookie example to a variable and use
req = HTTPRequest["www.example.com",<|"Cookies"->{cookies}|>];
URLRead@req;
I both tried adding and not adding a {}
to the cookies
but they all have the same results. Website shows me "permission-denied" and acquire login. I'm trying to capture my browser identity cookies and use them in mathematica HTTPRequest
function.
I use Fiddler to find out what request is sent by MMA kernel.
Here is the record of Fiddler:
As you can see, there is no cookies data sent in this request. I searched reference but not found examples for how to send requests with cookies data. Here is a request with normal cookies data from Edge.
I'm quite confused about the cookies usages in mathematica, reference shows only cookies management but not telling how to sending them. Can someone tells me how to send requests with correct cookies data? I'm using these requests to access and dig some websites which need certification.
HTTPRequest
with cookies works fine. Please add your complete code that you are using (that is, include also the definition ofcookies
) so that we can use the same code and test it. And also include which Mathematica version you are using. $\endgroup$ClearCookies[All]; ck = URLRead @ HTTPRequest["https://wolfram.com",CookieFunction->Print]
cookies=ck["Cookies"]
req = HTTPRequest["www.example.com",<|"Cookies"->{cookies}|>]; URLRead@req;
. The result of my subsequent monitoring of the sent requests on fiddler is the image I attached in the question. My MMA version is 13.2. $\endgroup$"Domain"
set to "wolfram.com" to work on "example.com"? :) You have to correctly set/change the domain. $\endgroup$