Created
February 21, 2021 01:19
-
-
Save btk/3a76a87495c1f95b407d000f2167e7bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const url = 'https://tenta.me/XXXXXX'; | |
const options = { | |
method: 'POST', | |
headers: { | |
"Content-Type": "application/json; charset=utf-8" | |
}}; | |
const request = http.request(url, options, (response) => { | |
console.log(response); | |
}); | |
request.on('error', (e) => { | |
console.error(e); | |
}); | |
request.write(JSON.stringify({ | |
"title": "Your notification title", | |
"description": "Your notification description", | |
"options": { | |
"detail1": "first detail", | |
"detail2": "second detail" | |
} | |
})); | |
request.end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => "https://tenta.me/XXXXXX", | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => "", | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, | |
CURLOPT_FOLLOWLOCATION => true, | |
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |
CURLOPT_CUSTOMREQUEST => "POST", | |
CURLOPT_POSTFIELDS => "{\n \"title\": \"Your notification title\",\n \"description\": \"Your notification description\",\n \"options\": {\n \"detail1\": \"first detail\",\n \"detail2\": \"second detail\"\n }\n}", | |
CURLOPT_HTTPHEADER => array( | |
"Content-Type: application/json; charset=utf-8" | |
) | |
)); | |
$response = curl_exec($curl); | |
curl_close($curl); | |
echo $response; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = 'https://tenta.me/XXXXXX' | |
headers = { | |
'Content-Type': 'application/json' | |
} | |
data = "{\n \"title\": \"Your notification title\",\n \"description\": \"Your notification description\",\n \"options\": {\n \"detail1\": \"first detail\",\n \"detail2\": \"second detail\"\n }\n}" | |
response = requests.request( | |
'POST', | |
'https://tenta.me/XXXXXX', | |
data=data, | |
headers=headers, | |
) | |
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -O - --method=POST \ | |
'https://tenta.me/XXXXXX' \ | |
--header='Content-Type: application/json; charset=utf-8' \ | |
--body-data='{ | |
"title": "Your notification title", | |
"description": "Your notification description", | |
"options": { | |
"detail1": "first detail", | |
"detail2": "second detail" | |
} | |
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch("https://tenta.me/XXXXXX", { | |
method: "POST", | |
body: JSON.stringify({ | |
"title": "Your notification title", | |
"description": "Your notification description", | |
"options": { | |
"detail1": "first detail", | |
"detail2": "second detail" | |
} | |
}), | |
headers: { | |
"Content-Type": "application/json; charset=utf-8" | |
}, | |
credentials: "same-origin" | |
}).then(function(response) { | |
response.status | |
response.statusText | |
response.headers | |
response.url | |
return response.text() | |
}).catch(function(error) { | |
error.message | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment