You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
700 B

2 months ago
<?php
namespace LaneWeChat\Core;
class Media {
public static function upload($filename, $type) {
$accessToken = AccessToken::getAccessToken();
$queryUrl = 'http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=' . $accessToken . '&type=' . $type;
$data = array('media' => '@' . $filename);
return Curl::callWebServer($queryUrl, $data, 'POST', 1, 0);
}
public static function download($mediaId) {
$accessToken = AccessToken::getAccessToken();
$queryUrl = 'http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=' . $accessToken . '&media_id=' . $mediaId;
return Curl::callWebServer($queryUrl, '', 'GET', 0);
}
}