i want to send information from JS on my domain to .php file in another domain securely and i want the .php to only accpet things coming from the specified domains .
This is Domain A
$.ajax({
POST: "https://domain-b.com/ant.php",
data: mystring
})
This is Domain B
<?php
for ($i=0;$i<count($_POST);$i++){
#send to DB code
}
?>
BTW both domain A and domain B are individual servers .
my understanding is because i am using HTTPS
the data sent securely and encrypted , however i see that anyone can send information from anywhere to the .php domain . i want to prevent that .
i thought of inserting a code acts like a password between the two but as i insert it in the JS it will be visible to anyone , so no use for it .