开发者社区 问答 正文

php发送企业消息一直失败求救啊!!

        $ACCESS_TOKEN=XXXXX;
    $url  = "https://oapi.dingtalk.com/message/send?access_token=$ACCESS_TOKEN";  
  
    function send_post($url, $post_data) {  
        $postdata = http_build_query($post_data);  
        $options = array(  
                    'http' => array(  
                        'method' => 'POST',  
                        'header' => 'Content-Type:application/json;charset=utf-8',  
                        'content' => $postdata,  
                    )  
        );  
    $context=stream_context_create($options);  
    $result =file_get_contents($url,true,$context);  
  
    return $result;  
    }  
    
    
    $post_data = array(
        'touser'  => '0150235361xxxx',
        'agentid' => '1426xxxx',
        'msgtype' => 'text',
                'text'=>array('content'=>'8888')
        );
    
    $post_data=json_encode($post_data);  
    $rese=send_post($url,$post_data);


    echo "rese:$rese";echo "<BR>";




就这么简单几句,一直失败,好像不少人都有这问题!!!!
提示:{"errcode":40035,"errmsg":"不合法的参数"}

展开
收起
小小茗 2016-03-30 09:59:06 4115 分享
分享
版权
举报
1 条回答
写回答
取消 提交回答
  • Rephp发送企业消息一直失败求救啊!!
    用其他函数就可以了,谢谢。
    目前又有另一个问题,发送的消息怎么换行?\r\n都不行。。
    2016-03-30 10:53:35 举报
    赞同 评论

    评论

    全部评论 (0)

    登录后可评论