79467182

Date: 2025-02-25 16:17:24
Score: 0.5
Natty:
Report link

See this example on github

In brief

*.js

fetch("post.php", {
method: "post",
mode: "cors",
headers: {
  "Content-Type": "application/json"
},
body: {myData: "hello world"}
})

*.php

$data = json_decode(trim(file_get_contents("php://input")));
echo $data["myData"] // prints hello world!
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: SimoneMSR