public function get_materials($type, $offset, $count)
{
$url = self::API_DOMAIN . 'cgi-bin/material/batchget_material?access_token=' . $this->get_access_token();
$xml = sprintf('{"type":"%s","offset":"%s","count":"%s"}', $type, $offset, $count);
$res = HttpCurl::post($url, $xml, 'json');
// 异常处理: 获取时网络错误
if ($res === false) {
return Error::code('ERR_GET');
}
// 判断是否调用成功
if ($res->errcode == 0) {
return array(null, $res);
} else {
return array($res, null);
}
}