header("Content-type: text/html; charset=utf-8");
$ACCESS_TOKEN = "你的ACCESS_TOKEN";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token={$ACCESS_TOKEN}");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$tmpInfo = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Errno'.curl_error($ch);
}
curl_close($ch);
var_dump($tmpInfo);
企业微信获取部门列表demo
最新推荐文章于 2024-06-22 10:00:44 发布