微信群发,图文消息

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_37675827/article/details/77285370

闲着没事,做了个小功能,微信群发消息,在测试号中使用,如有bug,请留言。不足之处,还望指点。

首先,

add.php

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<form action="https://api.weixin.qq.com/cgi-bin/media/upload?access_token=AYoWi5VtHj80fP5rmEEhmLNoIt1AZDBGG5_xqkjvdQHSBnmRUAHrhroN46_ooeEjwC6kZH007I1ngX8sBOT7pipJ6SeLpw3v-7_-pQ9F6CQcS8PCSM5TSe_yZVNLxCU0CKHgAFAOWT&type=image" method="post" enctype="multipart/form-data">
    <table>
            <td>图片</td>
            <td><input type="file" name="img"></td>
        </tr>
        <tr>
            <td></td>
            <td><input type="submit" value="提交"></td>
        </tr>
    </table>
</form>
</body>
</html>

其次:

add_one.php

<?php
$jsonmenu = '{
   "articles": [
         {
           "thumb_media_id":"Wjt22vbnXIT2g7diaoRe4XV0tBO6ImxxC7uMla3n6PGTSHiVOla3TJsX0vLDTiZ9",
                        "author":"xxx",
             "title":"Happy Day",
             "content_source_url":"www.qq.com",
             "content":"content",
             "digest":"digest",
                        "show_cover_pic":1
         }
   ]
}';

$url1="https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=AYoWi5VtHj80fP5rmEEhmLNoIt1AZDBGG5_xqkjvdQHSBnmRUAHrhroN46_ooeEjwC6kZH007I1ngX8sBOT7pipJ6SeLpw3v-7_-pQ9F6CQcS8PCSM5TSe_yZVNLxCU0CKHgAFAOWT";
$result1=https_request($url1, $jsonmenu);
var_dump($result1);
function https_request($url,$data = null){
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    if (!empty($data)){
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    }
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $output = curl_exec($curl);
    curl_close($curl);
    return $output;
}
?>


最后:

add_two.php

<?php
$jsonmenu = '{
   "touser":[
    "o5iJ6wi0ewPsMgCnvWqcoa-CFFDE",
    "o5iJ6wp37lOWQ6xp28f0sWOkZxRs"
   ],
   "mpnews":{
      "media_id":"iEgHgRsnoSa3uZuWYXQLvwTsRwBH-iLRBpiZLNvmuwEUNBfHIpJIcPCeSH_aNLae"
   },
    "msgtype":"mpnews",
    "send_ignore_reprint":0
}';

$url1="https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=AYoWi5VtHj80fP5rmEEhmLNoIt1AZDBGG5_xqkjvdQHSBnmRUAHrhroN46_ooeEjwC6kZH007I1ngX8sBOT7pipJ6SeLpw3v-7_-pQ9F6CQcS8PCSM5TSe_yZVNLxCU0CKHgAFAOWT";
$result1=https_request($url1, $jsonmenu);
var_dump($result1);
function https_request($url,$data = null){
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    if (!empty($data)){
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    }
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $output = curl_exec($curl);
    curl_close($curl);
    return $output;
}
?>


展开阅读全文

微信群发接口图文消息里面包含图片地址,群发之后图文消息内图片无法显示,为什么?

07-30

在进行微信群发接口上传图文素材过程中,遇到一个问题求指教。rn上传图文素材文档:rnrn "articles": [rn rn "thumb_media_id":"qI6_Ze_6PtV7svjolgs-rN6stStuHIjs9_DidOHaj0Q-mwvBelOXCFZiq2OsIU-p",rn "author":"xxx",rn "title":"Happy Day",rn "content_source_url":"www.qq.com",rn "content":"content",rn "digest":"digest",rn "show_cover_pic":"1"rn ,rn rn "thumb_media_id":"qI6_Ze_6PtV7svjolgs-rN6stStuHIjs9_DidOHaj0Q-mwvBelOXCFZiq2OsIU-p",rn "author":"xxx",rn "title":"Happy Day",rn "content_source_url":"www.qq.com",rn [color=#FF0000] "content":"content",[/color]rn "digest":"digest",rn "show_cover_pic":"0"rn rn ]rnrn参数 是否必须 说明rnArticles 是 图文消息,一个图文消息支持1到10条图文rnthumb_media_id 是 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得rnauthor 否 图文消息的作者rntitle 是 图文消息的标题rncontent_source_url 否 在图文消息页面点击“阅读原文”后的页面rn[color=#FF0000]content 是 图文消息页面的内容,支持HTML标签[/color]rndigest 否 图文消息的描述rnshow_cover_pic 否 是否显示封面,1为显示,0为不显示rn现在的问题是我在content里面带有图片地址,准备在内容中间显示图片,在进行预览过程中文字消息可以显示,但是文字中间的图片却无法显示,不知道什么原因造成的,求帮助!!在线等!! 论坛

没有更多推荐了,返回首页