本文整理汇总了PHP中HttpRequest::request方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpRequest::request方法的具体用法?PHP HttpRequest::request怎么用?PHP HttpRequest::request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpRequest
的用法示例。
在下文中一共展示了HttpRequest::request方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
public static function getInstance()
{
if (!isset(self::$request)) {
self::$request = new HttpRequest();
}
return self::$request;
}
示例2: send
/**
* 发送消息
* @param [type] $to [description]
* @param [type] $content [description]
* @return [type] [description]
*/
public function send($to, $content)
{
$user = json_decode($this->redis->get('WXuser' . UID), 1);
$data = array('BaseRequest' => array('DeviceID' => DeviceID, 'Sid' => $this->redis->get('WXsid' . UID), 'Skey' => $this->redis->get('WXuserSKey' . UID), 'Uin' => $this->redis->get('WXuin' . UID)), 'Msg' => array('FromUserName' => $user['UserName'], 'ToUserName' => $to, 'Type' => 1, 'Content' => $content, 'ClientMsgId' => 1, 'LocalID' => 1));
$data = $this->encode($data);
$result = HttpRequest::request('https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsg?sid=' . urlencode($this->redis->get('WXsid' . UID)) . '&r=' . 1, null, $data);
$result = json_decode($result['data'], 1);
if ($result['MsgID']) {
return 'success';
}
}