I am trying to send discord webhook message from my PHP website
I see on the console
This error dont read(" I am trying to send diI am trying to send discord webhook message from my PHP website I am trying to send discord webhook message from my PHP website scord webhook message from my PHP website")
(in the localhost the code works, but in the host not working)
I tried to solve it for days
Please I need help
my code
<?php
header('Access-Control-Allow-Origin: ');
?>
<?php include 'header.php' ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="assets/css/main.css?">
<title>title</title>
</head>
<body>
<h1 class="msg">welcome, we have send you the details in the provided webhook!</h1>
<script>
let webh = "https://discord.com/api/webhooks/xxx/xxx";
function send() {
var url = webh
var request = new XMLHttpRequest();
request.open("POST", url);
request.setRequestHeader('Content-type', 'application/json');
var myEmbed2 = {
"author": {
"name": "username",
"url": "https://i.imgur.com/pic.jpg",
},
"title": "title",
"url": "https://google.com/",
"description": "title",
"color": 15258703,
"fields": [
{
"name": "text",
"value": "text",
"inline": true
},
{
"name": "text",
"value": "text",
"inline": true
},
{
"name": "text",
"value": "text"
},
{
"name": "Thank You!",
"value": "text"
}
],
"thumbnail": {
"url": "https://i.imgur.com/pic.jpg"
},
"footer": {
"text": "text",
"icon_url": "https://i.imgur.com/pic.jpg"
}
}
var params = {
username: "username",
avatar_url: "https://i.imgur.com/pic.jpg",
embeds: [ myEmbed2 ]
}
request.send(JSON.stringify(params));
} // end send
send()
</script>
</body>
</html>