<?php
function request_by_curl($remote_server, $post_string) {  
    $ch = curl_init();  
    curl_setopt($ch, CURLOPT_URL, $remote_server);
    curl_setopt($ch, CURLOPT_POST, 1); 
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); 
    curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Content-Type: application/json;charset=utf-8'));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
    // 线下环境不用开启curl证书验证, 未调通情况可尝试添加该代码
    curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); 
    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
    $data = curl_exec($ch);
    curl_close($ch);  
    echo $data;
    return $data;  
}

//今天设置过菜单
$webhook = "https://oapi.dingtalk.com/robot/send?access_token=3acdb7313882f20c2f6cbc91c83719bea16667e244fa8a9eb0103aa893a1815f";

$data = array(
	'msgtype'=>'actionCard',
	'actionCard'=>array(
		'title'=>'Event新增了上线节点',
		"text"=> "**【妖灵战姬】上线:买量测试**\n\n日期：2021-01-13.",
		'hideAvatar'=>'0',
		'btnOrientation'=>'0',
		'btns' => array(
			array(
				'title'=>'查看详情',
				'actionURL'=>'http://10.0.0.5/leguevent/',
			)
		)
	),
	"at"=>array(
         "isAtAll"=>true
    )
);

$data_string = json_encode($data);
$result = request_by_curl($webhook, $data_string);  
echo $result;
?>