wpatom 插件使用 api 创建基于帖子的群聊

问题描述 投票:0回答:1

发布帖子时创建组存在问题,所以我想创建基于帖子的组是否有 api 调用的示例/示例

我在我的网站上添加了atom wp聊天插件,并希望从后端启用帖子基础群聊,但它在那里不可用

php ajax wordpress plugins customization
1个回答
0
投票

我刚刚看到有 api 并修复了它,只是想与我的软件开发人员分享我的 api 代码,这是我在我的网站上发布帖子后调用的 api

        $curl = curl_init();
        curl_setopt_array($curl, [
        CURLOPT_URL => 'https://api.cometondemand.net/api/v2/createGroup',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_HTTPHEADER => [
            "Accept: application/json",
            "Content-Type: application/x-www-form-urlencoded",
            'Api-Key: your-atom-apikey'
        ],
        CURLOPT_POSTFIELDS=> "GUID=GroupId&name=Groupname"

        ]);
        
        $response = curl_exec($curl);
        $err = curl_error($curl);
        
        curl_close($curl);
        
        if ($err) {
            echo "cURL Error #:" . $err;
        } else {
            echo $response;
        //  echo "<script>alert(".$post_id.")</script>";
        
        };
© www.soinside.com 2019 - 2024. All rights reserved.