# $\_POST data disappeared (from another domain) =\> no solutions

**URL:** <https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894>\
**Category:** Hosting Support\
**Created:** [March 9, 2024, 10:39am UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894 "2024-03-09T10:39:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![MialaProg](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/mialaprog/32/46772_2.png) [@MialaProg](https://forum.infinityfree.com/u/MialaProg)\
**Post date:** [March 9, 2024, 10:39am UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894/1 "2024-03-09T10:39:05Z")

</div>

### Error Message

When I validate a form from another domain, the \_POST data disappeared. How can I send this data ? PS: Sometimes this data are big so I can’t use GET.

### Other Information

How can I send data from another domain to my website ?

---

<div class="post-metadata">

**Author:** ![Greenreader9](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/greenreader9/32/22847_2.png) [@Greenreader9](https://forum.infinityfree.com/u/Greenreader9)\
**Post date:** [March 9, 2024, 2:35pm UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894/2 "2024-03-09T14:35:22Z")

</div>

> [@MialaProg](#):
>
> How can I send data from another domain to my website

Using an HTML form?

Can you share the front end and backend code you have?

---

<div class="post-metadata">

**Author:** ![MialaProg](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/mialaprog/32/46772_2.png) [@MialaProg](https://forum.infinityfree.com/u/MialaProg)\
**Post date:** [March 9, 2024, 2:49pm UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894/3 "2024-03-09T14:49:06Z")

</div>

Front:

```auto
function sendToServer(playlist_txt, listID, nb) {
    // Créez un formulaire dynamiquement
    var form = document.createElement('form');
    form.method = 'POST';
    form.action = 'https://yt.mi.42web.io/add.php';

    // Ajoutez les champs et leurs valeurs
    var champ1 = document.createElement('input');
    champ1.type = 'hidden';
    champ1.name = 'playlist';
    champ1.value = playlist_txt;
    form.appendChild(champ1);

    var champ2 = document.createElement('input');
    champ2.type = 'hidden';
    champ2.name = 'nb';
    champ2.value = nb;
    form.appendChild(champ2);

    var champ3 = document.createElement('input');
    champ3.type = 'hidden';
    champ3.name = 'listID';
    champ3.value = listID;
    form.appendChild(champ3);

    var champ4 = document.createElement('input');
    champ4.type = 'hidden';
    champ4.name = 'name';
    champ4.value = document.title;
    form.appendChild(champ4);

    document.body.appendChild(form);
    form.submit();
}

```

Back:

```auto
var_dump($_POST);

```

Return:  
array(0) =\> {}

---

<div class="post-metadata">

**Author:** ![anon42008019](https://forum.infinityfree.com/letter_avatar/anon42008019/32/6_22734026db12803ebb3e059622ac3534.png) [@anon42008019](https://forum.infinityfree.com/u/anon42008019)\
**Post date:** [March 9, 2024, 3:34pm UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894/4 "2024-03-09T15:34:08Z")

</div>

You need to investigate if the javascript code even works at the first place.

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [March 9, 2024, 3:47pm UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894/5 "2024-03-09T15:47:33Z")

</div>

CORS might be an issue when trying to post things to a different domain. A Content Security Policy might also prevent it. Finally, free hosting has a security system that blocks many cross domain things: [Ensuring only web browsers can access your website](https://forum.infinityfree.com/t/ensuring-only-web-browsers-can-access-your-website/49353)

And that’s all assuming your code is correct. Because I’ve personally never thought of using DOM manipulation to construct a POST request.

The first thing I would do is to open the Network tab in my browser’s Developer Tools to make sure that:

- The POST request is actually being sent.
- The POST parameters are set correctly.
- No additional redirects occur between submitting the form and hitting the PHP code on the other hand (POST data is not submitted again if the first request returns a redirect).

---

<div class="post-metadata">

**Author:** ![MialaProg](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/mialaprog/32/46772_2.png) [@MialaProg](https://forum.infinityfree.com/u/MialaProg)\
**Post date:** [March 9, 2024, 4:20pm UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894/6 "2024-03-09T16:20:35Z")

</div>

Post data are correctly send but after the ?i= redirection, there are not re-send… -\_- It’s sad because this security system limit our possibilities… Is there any way to the server re-send the post data after a ?i= redirection ?

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [March 9, 2024, 4:28pm UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894/7 "2024-03-09T16:28:17Z")

</div>

> [@MialaProg](#):
>
> Is there any way to the server re-send the post data after a ?i= redirection ?

I don’t think so. I can’t think of any workaround to this particular issue that could be applied here.

To make your project succeed, I can offer a few suggestions:

- Consider getting rid of all the different subdomains. There is technically very little reason to have them, and as you’re experiencing, there are downsides to splitting stuff across domains.
- If you do need to share data among subdomains on the same account, consider using a MySQL database for that. You can submit the data from one subdomain to the database and read from that same data from another subdomain without any problems.

---

<div class="post-metadata">

**Author:** ![MialaProg](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/mialaprog/32/46772_2.png) [@MialaProg](https://forum.infinityfree.com/u/MialaProg)\
**Post date:** [March 9, 2024, 4:33pm UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894/8 "2024-03-09T16:33:00Z")

</div>

How the security system makes the difference between a request from the same domain and a request from another domain ? Because maybe with a chrome extension we can say to the server “hey ! It’s ok ! I’m from the same domain”

---

<div class="post-metadata">

**Author:** ![Greenreader9](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/greenreader9/32/22847_2.png) [@Greenreader9](https://forum.infinityfree.com/u/Greenreader9)\
**Post date:** [March 9, 2024, 4:50pm UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894/9 "2024-03-09T16:50:48Z")

</div>

> [@MialaProg](#):
>
> How the security system makes the difference between a request from the same domain and a request from another domain ?

Because that’s how CORS works. A policy is defined at a single `protocol`://`domain` :`port`

[https://fetch.spec.whatwg.org/#cross-origin-resource-policy-header](https://fetch.spec.whatwg.org/#cross-origin-resource-policy-header)

[https://fetch.spec.whatwg.org/#cors-protocol-and-credentials](https://fetch.spec.whatwg.org/#cors-protocol-and-credentials)

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [March 10, 2024, 10:12am UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894/10 "2024-03-10T10:12:26Z")

</div>

It works through cookie isolation. When you first visit any site hosted here, the security challenge will set a cookie in your browser valid for that specific domain. So if you are viewing `mi.42web.io`, then the cookie will only be valid for `mi.42web.io`. If you then try to navigate to `yt.mi.42web.io`, then the same cookie is not sent, and the security challenge is presented again.

I’m not familiar with the exact APIs available to browser extensions and if you can copy cookies between domains. Maybe it’s possible, but having to use a browser extension so you can spread a website across multiple subdomains seems like a pretty impractical and cumbersome solution to me.

---

<div class="post-metadata">

**Author:** ![Meishin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/meishin/32/59902_2.png) [@Meishin](https://forum.infinityfree.com/u/Meishin)\
**Post date:** [March 10, 2024, 10:35am UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894/11 "2024-03-10T10:35:35Z")

</div>

> [@Admin](#):
>
> if you can copy cookies between domains

It’s possible between a base domain and a subdomain.  
It’s also possible to copy cookies between different base domains, but that’s diasbled by modern browsers by default, and Chrome is dropping support for it in the latest version.

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [March 17, 2024, 10:36am UTC](https://forum.infinityfree.com/t/post-data-disappeared-from-another-domain-no-solutions/90894/12 "2024-03-17T10:36:04Z")

</div>

Closed on March 17, 2024, 10:36am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
