本文整理汇总了PHP中CHTTP::sGetHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP CHTTP::sGetHeader方法的具体用法?PHP CHTTP::sGetHeader怎么用?PHP CHTTP::sGetHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHTTP
的用法示例。
在下文中一共展示了CHTTP::sGetHeader方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetCurrentUser
public function GetCurrentUser()
{
if ($this->access_token === false) {
return false;
}
$result = CHTTP::sGetHeader(static::CONTACTS_URL . '?access_token=' . urlencode($this->access_token), array(), $this->httpTimeout);
if (!defined("BX_UTF")) {
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
}
$result = CUtil::JsObjectToPhp($result);
if (is_array($result)) {
$result["access_token"] = $this->access_token;
$result["refresh_token"] = $this->refresh_token;
$result["expires_in"] = $this->accessTokenExpires;
}
return $result;
}
示例2: GetCurrentUser
public function GetCurrentUser()
{
if ($this->access_token === false) {
return false;
}
$result = CHTTP::sGetHeader(self::GRAPH_URL . '/me?access_token=' . $this->access_token . "&fields=picture,id,name,first_name,last_name,gender,birthday,email", array(), $this->httpTimeout);
if (!defined("BX_UTF")) {
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
}
return CUtil::JsObjectToPhp($result);
}
示例3: GetCurrentUser
public function GetCurrentUser()
{
if($this->access_token === false)
return false;
$result = CHTTP::sGetHeader(self::USERINFO_URL.'?format=json&oauth_token='.urlencode($this->access_token), array(), $this->httpTimeout);
if(!defined("FX_UTF"))
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
$result = CUtil::JsObjectToPhp($result);
if(is_array($result))
{
$result["access_token"] = $this->access_token;
$result["refresh_token"] = $this->refresh_token;
$result["expires_in"] = $this->accessTokenExpires;
}
return $result;
}
示例4: SendFeed
public function SendFeed($socServUserId, $message, $getNewToken = true)
{
if (!$this->access_token || intval($this->userId) < 1) {
self::SetOauthKeys($socServUserId);
}
if (!defined("BX_UTF")) {
$message = CharsetConverter::ConvertCharset($message, LANG_CHARSET, "utf-8");
}
$this->sign = strtolower(md5('application_key=' . $this->appKey . 'method=users.setStatusstatus=' . $message . md5($this->access_token . $this->appSecret)));
$result = CHTTP::sGetHeader(self::CONTACTS_URL . "?method=users.setStatus&application_key=" . $this->appKey . "&access_token=" . $this->access_token . "&sig=" . $this->sign . "&status=" . urlencode($message), array(), $this->httpTimeout);
if (!defined("BX_UTF")) {
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
}
$arResult = CUtil::JsObjectToPhp($result);
if ($getNewToken === true && isset($arResult["error_code"]) && $arResult["error_code"] == "102") {
$newToken = self::RefreshToken($socServUserId);
if ($newToken === true) {
self::SendFeed($socServUserId, $message, false);
} else {
return false;
}
}
return $arResult;
}
示例5: GetCurrentUser
public function GetCurrentUser()
{
if($this->access_token === false)
return false;
$result = CHTTP::sGetHeader(self::CONTACTS_URL.'?uids='.$this->userID.'&fields=uid,first_name,last_name,nickname,screen_name,sex,bdate,city,country,timezone,photo,photo_medium,photo_big,photo_rec&access_token='.urlencode($this->access_token), array(), $this->httpTimeout);
if(!defined("BX_UTF"))
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
return CUtil::JsObjectToPhp($result);
}
示例6: GetCurrentUserFriends
public function GetCurrentUserFriends($limit = 0, $offset = 0)
{
if($this->access_token === false)
return false;
$url = self::FRIENDS_URL."?access_token=".urlencode($this->access_token);
if($limit > 0)
{
$url .= '&limit='.intval($limit)."&offset=".intval($offset);
}
$result = CHTTP::sGetHeader($url, array(), $this->httpTimeout);
if(!defined("BX_UTF"))
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
$result = CUtil::JsObjectToPhp($result);
if(is_array($result))
{
$result["access_token"] = $this->access_token;
$result["refresh_token"] = $this->refresh_token;
$result["expires_in"] = $this->accessTokenExpires;
}
return $result;
}
示例7: GetCurrentUser
public function GetCurrentUser()
{
if ($this->access_token === false) {
return false;
}
$sign = md5("app_id=" . $this->appID . "method=users.getInfosecure=1session_key=" . $this->access_token . $this->appSecret);
$result = CHTTP::sGetHeader(self::CONTACTS_URL . '?method=users.getInfo&secure=1&app_id=' . $this->appID . '&session_key=' . urlencode($this->access_token) . '&sig=' . $sign, array(), $this->httpTimeout);
if (!defined("BX_UTF")) {
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
}
return CUtil::JsObjectToPhp($result);
}
示例8: GetCurrentUserFriends
public function GetCurrentUserFriends($limit, &$next)
{
if ($this->access_token === false) {
return false;
}
$url = self::FRIENDS_URL . '?uids=' . $this->userID . '&fields=uid,first_name,last_name,nickname,screen_name,photo_200_orig,contacts,email&access_token=' . urlencode($this->access_token);
if ($limit > 0) {
$url .= "&count=" . intval($limit) . "&offset=" . intval($next);
}
$result = CHTTP::sGetHeader($url, array(), $this->httpTimeout);
if (!defined("BX_UTF")) {
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
}
$result = CUtil::JsObjectToPhp($result);
$next = $limit + $next;
return $result;
}
示例9: GetAllPages
private function GetAllPages($arResult)
{
static $arTwits = array();
if (!isset($arResult["search_metadata"]["next_results"])) {
return $arTwits;
}
parse_str(preg_replace("|\\?|", '', $arResult["search_metadata"]["next_results"]), $searchMetaData);
$arParams = array_merge(array("count" => $searchMetaData["count"], "include_entities" => $searchMetaData["include_entities"], "max_id" => $searchMetaData["max_id"]), $this->GetDefParams());
$arParams = array_merge($arParams, array("oauth_token" => $this->token, "q" => $searchMetaData["q"]));
$arParams["oauth_signature"] = urlencode($this->BuildSignature($this->GetSignatureString($arParams, self::SEARCH_URL)));
$arHeaders = array("Authorization" => 'OAuth oauth_consumer_key="' . $arParams["oauth_consumer_key"] . '", oauth_nonce="' . $arParams["oauth_nonce"] . '", oauth_signature="' . $arParams["oauth_signature"] . '", oauth_signature_method="HMAC-SHA1", oauth_timestamp="' . $arParams["oauth_timestamp"] . '", oauth_token="' . $this->token . '", oauth_version="1.0"', "Content-type" => "application/x-www-form-urlencoded");
$result = CHTTP::sGetHeader(self::SEARCH_URL . "?count=" . $searchMetaData["count"] . "&include_entities=" . $searchMetaData["include_entities"] . "&max_id=" . $searchMetaData["max_id"] . "&q=" . urlencode($searchMetaData["q"]), $arHeaders, $this->httpTimeout);
if (!defined("BX_UTF")) {
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
}
$arResult = CUtil::JsObjectToPhp($result);
if (is_array($arResult["statuses"])) {
$arTwits = array_merge($arTwits, $arResult["statuses"]);
}
return self::GetAllPages($arResult);
}
示例10: GetCurrentUser
public function GetCurrentUser()
{
if ($this->access_token === false) {
return false;
}
$result = CHTTP::sGetHeader(self::CONTACTS_URL . "?access_token=" . urlencode($this->access_token), array(), $this->httpTimeout);
if (!defined("BX_UTF")) {
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
}
return CUtil::JsObjectToPhp($result);
}
示例11: getPlannerTasksId
public function getPlannerTasksId()
{
$arHeaders = array();
$result = CHTTP::sGetHeader($this->portalURI.'/rest/task.planner.getlist?auth='.$this->access_token, $arHeaders, $this->httpTimeout);
return $this->prepareAnswer($result);
}
示例12: GetCurrentUserFriends
public function GetCurrentUserFriends($limit, &$next)
{
if ($this->access_token === false) {
return false;
}
if (empty($next)) {
$url = self::GRAPH_URL . '/me/friends?access_token=' . $this->access_token . "&fields=picture,id,name,first_name,last_name,gender,birthday,email";
if ($limit > 0) {
$url .= "&limit=" . intval($limit) . "&offset=" . intval($next);
}
} else {
$url = $next;
}
$result = CHTTP::sGetHeader($url, array(), $this->httpTimeout);
if (!defined("BX_UTF")) {
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
}
$result = CUtil::JsObjectToPhp($result);
if (is_array($result['paging']) && !empty($result['paging']['next'])) {
$next = $result['paging']['next'];
} else {
$next = '';
}
return $result;
}
示例13: GetAccessToken
public function GetAccessToken($redirect_uri)
{
$token = $this->getStorageTokens();
if (is_array($token)) {
$this->access_token = $token["OATOKEN"];
$this->accessTokenExpires = $token["OATOKEN_EXPIRES"];
if ($this->checkAccessToken()) {
return true;
}
}
if ($this->code === false) {
return false;
}
$result = CHTTP::sGetHeader(self::GRAPH_URL . '/oauth/access_token?client_id=' . $this->appID . '&client_secret=' . $this->appSecret . '&redirect_uri=' . urlencode($redirect_uri) . '&code=' . urlencode($this->code), array(), $this->httpTimeout);
$arResult = array();
$arResultLongLive = array();
parse_str($result, $arResult);
if (isset($arResult["access_token"]) && $arResult["access_token"] != '') {
$result = CHTTP::sGetHeader(self::GRAPH_URL . "/oauth/access_token?grant_type=fb_exchange_token&client_id=" . $this->appID . "&client_secret=" . $this->appSecret . "&fb_exchange_token=" . $arResult["access_token"], array(), $this->httpTimeout);
parse_str($result, $arResultLongLive);
if (isset($arResultLongLive["access_token"]) && $arResultLongLive["access_token"] != '') {
$arResult["access_token"] = $arResultLongLive["access_token"];
$arResult["expires"] = $arResultLongLive["expires"];
$_SESSION["OAUTH_DATA"] = array("OATOKEN" => $arResultLongLive["access_token"], "OATOKEN_EXPIRES" => time() + $arResultLongLive['expires']);
}
$this->access_token = $arResult["access_token"];
$this->accessTokenExpires = time() + $arResult["expires"];
return true;
}
return false;
}