Define session from domain to another

Define session from domain to another

I've two websites with two different domains name and I need define a session on my second website using my first one.

I've two websites with two different domains name and I need define a session on my second website using my first one.

Here is my code.

domain1.com

$.post('https://domain2.com/setter.php', { 'fieldname' : '5Unask819xK', 'value' : '14bx704KnPq6'});

domain2.com

session_start();
$_SESSION[$_POST['fieldname']] = $_POST['value'];

And now, at domain2.com, if I try run this code:

if (isset($_SESSION['5Unask819xK'])) {
    echo 'exists';
} else {
    echo 'fail';
}

I'll get "fail" as response. What am I doing wrong? There are no errors. Can you help me?

Thank you!

php ajax

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Country State City Dropdown list in PHP MySQL PHP

Country state city dropdown using ajax in php. You'll learn how to populate country city state dropdown based on previous selection in php using ajax

PHP mysql Categories and Subcategories Example

PHP mysql dynamic dropdown list onchange. Here, we'll show how to populate category and subcategory in dropdown list using ajax in PHP mysql

Hire Dedicated PHP Developer

Looking to hire affordable yet experienced PHP developers? **[Hire Dedicated PHP Developer](https://hourlydeveloper.io/hire-dedicated-php-developer/ "Hire Dedicated PHP Developer")**, who can convert your idea to reality, within the stipulated...

Category Subcategory Dropdown in PHP MySQL Ajax

PHP mysql dynamic dropdown list onchange. Here, we'll show how to populate category and subcategory in dropdown list using ajax in PHP mysql

PHP Web Application Development Company

As a top **PHP Web Application Development Company in USA**[https://www.dataeximit.com/php-development-services/](https://www.dataeximit.com/php-development-services/ "https://www.dataeximit.com/php-development-services/"), we at Data EximIT have...