Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
Javascript/PHP send/get cookie to different URI

I need to send cookies between two websites, website A and website B

Website A code: (JS)

var xhr = new XMLHttpRequest();
            xhr.open('GET', 'https://websiteb.com/?sessid=<?php echo session_id(); ?>', true);
            xhr.withCredentials = true;
            xhr.send(null);

Wesbite B code: (PHP)

header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Headers: Set-Cookie");
header("Access-Control-Allow-Origin: https://websiteA.tld");
header('Content-Type: application/json');
setcookie('PHPSESSID', $_GET['sessid'], array(
        'expires' => time() + $cookielifetime,
        'path' => '/',
        'secure' => true,
        'httponly' => false,
        'SameSite' => 'None'
));

This code only works on my machine, but not an external device.

Here are postman logs, however i only get website A's cookies.

Postman POST logs

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!