當(dāng)前位置:首頁>文章中心>技術(shù)文檔>PHP企業(yè)微信的機(jī)器人函數(shù)

PHP企業(yè)微信的機(jī)器人函數(shù)

發(fā)布時(shí)間:2023-01-11 點(diǎn)擊數(shù):12061
function posturl($data){
    $data_content = '{"msgtype":"text","text":{"content":"'.$data.'"}';// 直接發(fā)送消息
    $url = "機(jī)器人webhook地址";
    $headerArray =array("Content-type:application/json;charset='utf-8'","Accept:application/json");
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data_content);
    curl_setopt($curl,CURLOPT_HTTPHEADER,$headerArray);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $output = curl_exec($curl);
    curl_close($curl);
    return json_decode($outputtrue);}


我要評論

評論內(nèi)容:

驗(yàn)證碼:
驗(yàn)證碼

微信二維碼

0691-8131800

滇公網(wǎng)安備 53282302000057號