Advertisement
Mayumi_H

ifttt to discord (fixed url)

Jan 14th, 2023 (edited)
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2. $json = file_get_contents('php://input');//Jsonはphpから受け取るらしい
  3. if(empty($json)) die();
  4. $webhook_url = 'https://discord.com/api/webhooks/~ あなたの webhook URL ~';
  5. //curlで送信する
  6. $ch = curl_init();
  7. curl_setopt($ch, CURLOPT_URL, $webhook_url);//配列が好きならcurl_setopt_arrayでもok
  8. curl_setopt($ch, CURLOPT_POST, true);
  9. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8'));
  10. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  11. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  12. curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
  13. curl_exec($ch);
  14. curl_close($ch);
  15. echo "ok";
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement