微信素材:
将图片添加到素材库:
方法一:
在linux服务器下,选择当前文件夹下的一张图片,如:kefuwechat.jpg,执行如下命令,
curl -F media=@kefuwechat.jpg "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=access_token&type=image"
方法二:
$access_token = file_get_contents("test_access_token"); $url = 'https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token='.$access_token; $img = 'LOGO-20161021-02.png'; if (class_exists('\CURLFile')) { $data['media'] = new \CURLFile(realpath($img)); } else { $data['media'] = '@'.realpath($img); } $res = sendUrl($url,false,'post',$data);