I have successfully executed fetch request from the javascript code below
await fetch("api-path", {
method: "POST",
headers: { "Content-Type": "application/json; charset=UTF-8" },
body: JSON.stringify({ key01: "value01", key02: "value02" }),
credentials: "include"
})
.then (async (res) => {
const jRes = await res.json();
return jRes;
});
I want to make a similar request using php curl, however, not sure how to send credentials: “include” parameter with the php curl request ! Can some one guide for the same?
I have put the following code in PHP file, along with curl request, but it did not help:
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true');