D
D
dake12312015-07-20 09:28:21
PHP
dake1231, 2015-07-20 09:28:21

How to send a POST request to slack?

Hello! I can't send a message to slack, I try like this:

$url = 'https://hooks.slack.com/services/{token}';
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_PROXY,"proxy ip");
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_POSTFIELDS, 'payload={"text":"test"}');
  $result = curl_exec($ch);
  curl_close($ch);

  var_dump($result);

An empty string comes in response, I tried to send messages via POSTMAN

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dake1231, 2015-07-29
@dake1231

Need to send in raw without payload

A
alek13-me, 2018-02-14
@alek13-me

phpprofi.ru/blogs/post/96

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question