public function add()
$post_data = array(
'Account' => '',//企业账号
'Password' => '',//企业密码
'openid' => '',//微信好唯一标识
'body' => '',//内容
);
$this->send_postss('url', $post_data);//url 是指发送到企业微信的地址
}
function send_post($url, $post_data) {
// requests.packages.urllib3.disable_warnings();
$postdata = http_build_query($post_data);
$options = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type:application/x-www-form-urlencoded',
'content' => $postdata,
'timeout' => 15 * 60 // 超时时间(单位:s)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}