0

I wrote a code using PHP Curl, but for some reason it does not send the cookie needed to log in to the system. I noticed that it only works in firefox version 78. I can't log in because I can't send cookies in new version browsers. What could be the reason?

$MSG = $_GET["MSG"];
$CURL = curl_init();
curl_setopt_array($CURL, 
    [CURLOPT_URL => "EXAMPLE_URL",
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_USERAGENT => $_SERVER["HTTP_USER_AGENT"],
    CURLOPT_POST => TRUE,
    CURLOPT_POSTFIELDS => $MSG,
    CURLOPT_FOLLOWLOCATION => TRUE,
    CURLOPT_SSL_VERIFYPEER => FALSE,
    CURLOPT_SSL_VERIFYHOST => FALSE, 
    CURLOPT_COOKIE => "PASSWORD=123456789;secure;HttpOnly;samesite=None",
    CURLOPT_HTTPHEADER => array("Content-Type: text/plain;charset=UTF-8"),
    CURLOPT_VERBOSE => TRUE]
);
echo curl_exec($CURL);
curl_close($CURL); 

I tried to log in by sending the cookie, but it did not detect the cookie. In the 78th version of firefox browser, it sent the cookie successfully and I could log in to the system. I cannot do this in new generation browsers, what is the reason?

Harvey Dent
  • 1,193
  • 2
  • 4
  • 12
  • may be this will help https://stackoverflow.com/questions/3008817/login-to-remote-site-with-php-curl – Farhan Mar 31 '22 at 17:36

0 Answers0