'https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=', 'addTemplate' => 'https://api.weixin.qq.com/wxaapi/newtmpl/addtemplate?access_token=', 'deleteTemplate' => 'https://api.weixin.qq.com/wxaapi/newtmpl/deltemplate?access_token=', 'getCategory' => 'https://api.weixin.qq.com/wxaapi/newtmpl/getcategory?access_token=', 'getPubTemplateKeyWordsById' => 'https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatekeywords?access_token=', 'getPubTemplateTitleList' => 'https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles?access_token=', 'getTemplateList' => 'https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate?access_token=', 'uniformMessage' => 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=', ]; public function __call($method, $arguments) { if (!isset($this->requestUrl[$method])) { throw new ErrorException('Method ' . $method . ' not exists'); } $num = count($arguments); if ($num != 2) { throw new ErrorException('Method ' . $method . ' needs two arguments. ' . $num . ' arguments given.'); } $url = $this->requestUrl[$method] . $arguments[0]; $data = $this->curl($url, json_encode($arguments[1])); return $data; } }