本文整理汇总了PHP中HttpRequest::sendHttpRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpRequest::sendHttpRequest方法的具体用法?PHP HttpRequest::sendHttpRequest怎么用?PHP HttpRequest::sendHttpRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpRequest
的用法示例。
在下文中一共展示了HttpRequest::sendHttpRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getJsToken
public static function getJsToken($token)
{
$url = sprintf(self::WECHAT_JS_TOKEN, $token);
$result = HttpRequest::sendHttpRequest($url);
$data = json_decode($result['content']);
$result = isset($data->ticket) ? $data->ticket : Globals::$wechatErrorCode[$data->errcode];
$status = isset($data->ticket) ? self::OK : self::FAILED;
return array('status' => $status, 'result' => $result);
}
示例2: _getOpenReplay
private function _getOpenReplay($responseId)
{
$post_string = $GLOBALS["HTTP_RAW_POST_DATA"];
$openReplayInfo = OpenReplayModel::model()->with('open_openPlatForm')->findByPk($responseId);
$apiUrl = $openReplayInfo->open_openPlatForm->apiUrl;
$token = $openReplayInfo->open_openPlatForm->token;
$wechatApi = new WechatApi($token);
$url = $wechatApi->buildSignUrl($apiUrl);
$result = HttpRequest::sendHttpRequest($url, $post_string, 'POST', array("Content-type: text/xml"));
return $result['content'] ? $result['content'] : '';
}
示例3: actionDeleteMenu
public function actionDeleteMenu($wechatId)
{
$status = -1;
$token = $this->_getToken($wechatId);
$tokenValue = $token['tokenValue'];
if ($tokenValue) {
$url = sprintf(Globals::MENU_DELETE_URL, $tokenValue);
$result = HttpRequest::sendHttpRequest($url);
$resultData = json_decode($result['content']);
$status = $resultData->errcode == Globals::WECHAT_RESPONSE_OK ? 1 : -1;
$msg = $resultData->errcode == Globals::WECHAT_RESPONSE_OK ? '' : Globals::$wechatErrorCode[$resultData->errcode];
} else {
$msg = '获取token异常';
}
echo json_encode(array('status' => $status, 'msg' => $msg));
}