{"flag":true,"single":true,"pageTitle":"Send messages to slack using php | slack api","post":{"id":324,"user_id":"1","slug":"send-messages-to-slack-using-php-slack-api-n5ju","title":"Send messages to slack using php | slack api","body":"<p><strong>1. goto here and create an app<\/strong><\/p>\r\n<p>https:\/\/api.slack.com\/apps<\/p>\r\n<p><strong>2.&nbsp; select app and click on incoming-webhooks and add new webhook you will get an url<\/strong><\/p>\r\n<p><strong>3. use this code&nbsp;<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>$ch = curl_init();\r\n$url_bitsleader = \"https:\/\/hooks.slack.com\/services\/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\";\r\n$url_notify =\"https:\/\/hooks.slack.com\/services\/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\";\r\ncurl_setopt($ch, CURLOPT_URL, $url_notify);\r\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\ncurl_setopt($ch, CURLOPT_POSTFIELDS, \"{\\\"text\\\":\\\"Awesom, Farhan is gay!\\\"}\");\r\ncurl_setopt($ch, CURLOPT_POST, 1);\r\n\r\n$headers = array();\r\n$headers[] = 'Content-Type: application\/json';\r\ncurl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\r\n\r\n$result = curl_exec($ch);\r\nif (curl_errno($ch)) {\r\n    echo 'Error:' . curl_error($ch);\r\n}\r\ncurl_close ($ch);\r\n\r\nprint_r($result);<\/code><\/pre>\r\n<p>&nbsp;<\/p>","category_id":"1","is_private":"0","created_at":"2026-01-07T03:53:10.000000Z","updated_at":"2026-01-07T03:53:10.000000Z","category":{"id":1,"user_id":"1","name":"PHP","slug":"php-3ius","parent_id":null,"created_at":"2023-03-14T03:58:19.000000Z","updated_at":"2023-03-14T03:58:19.000000Z"},"user":{"id":1,"name":"R GONDAL","email":"rizikmw@gmail.com","email_verified_at":null,"two_factor_confirmed_at":null,"current_team_id":"1","profile_photo_path":null,"created_at":"2023-03-12T10:49:33.000000Z","updated_at":"2025-01-10T12:59:00.000000Z","profile_photo_url":"https:\/\/ui-avatars.com\/api\/?name=R+G&color=7F9CF5&background=EBF4FF"}},"pageDesc":"1. goto here and create an app https:\/\/api.slack.com\/apps 2.&nbsp; select app and click on incoming-webhooks and add new webhook you will ge - Send messages to slack using php | slack api (Updated: January 7, 2026) - Read more about Send messages to slack using php | slack api at my programming site [SITE]","categories":[]}