Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. $hookObject = json_encode([
  2. "content" => $content,
  3. "username" => $username,
  4. "avatar_url" => $avatar_url,
  5. "tts" => false,
  6. "embeds" => [
  7. [
  8. "title" => $title,
  9. "type" => "rich",
  10. "description" => $message,
  11. "url" => $url,
  12. "color" => hexdec("FFFFFF"),
  13. "thumbnail" => [
  14. "url" => $thumbnail
  15. ],
  16. "fields" => [
  17. [
  18. "name" => "Name 1",
  19. "value" => "Value 1",
  20. "inline" => true
  21. ],
  22. [
  23. "name" => "Name 2",
  24. "value" => "Value 2",
  25. "inline" => true
  26. ],
  27. [
  28. "name" => "Name 3",
  29. "value" => "Value 3",
  30. "inline" => true
  31. ]
  32. ]
  33. ]
  34. ]
  35.  
  36. ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
  37.  
  38. $ch = curl_init();
  39.  
  40. curl_setopt_array($ch, [
  41. CURLOPT_URL => $webhook,
  42. CURLOPT_POST => true,
  43. CURLOPT_POSTFIELDS => $hookObject,
  44. CURLOPT_HTTPHEADER => [
  45. "Length" => strlen($hookObject),
  46. "Content-Type" => "multipart/form-data"
  47. ]
  48. ]);
  49.  
  50. $response = curl_exec($ch);
  51. curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement