Пример #1
0
 function GetFood($foodId, $subCats = false, $flagDefaultServing = false)
 {
     $url = Client::$base . 'method=food.get';
     $url = $url . '&food_id=' . $foodId;
     if ($subCats) {
         $url = $url . '&include_sub_categories=true';
     }
     if ($flagDefaultServing) {
         $url = $url . '&flag_default_serving=true';
     }
     $oauth = new OAuthBase();
     $normalizedUrl;
     $normalizedRequestParameters;
     $signature = $oauth->GenerateSignature($url, $this->_consumerKey, $this->_consumerSecret, '', '', $normalizedUrl, $normalizedRequestParameters);
     $response = $this->GetQueryResponse($normalizedUrl, $normalizedRequestParameters . '&' . OAuthBase::$OAUTH_SIGNATURE . '=' . urlencode($signature));
     return $response;
 }
Пример #2
0
 function requestapi($url, $token = null, $secret = null)
 {
     $oauth = new OAuthBase();
     $normalizedUrl;
     $normalizedRequestParameters;
     $signature = $oauth->GenerateSignature($url, $this->_consumerKey, $this->_consumerSecret, $token, $secret, $normalizedUrl, $normalizedRequestParameters);
     $doc = simplexml_load_string($this->GetQueryResponse($normalizedUrl, $normalizedRequestParameters . '&' . OAuthBase::$OAUTH_SIGNATURE . '=' . urlencode($signature)));
     return $this->getArray($doc);
 }
Пример #3
0
 function ProfileRequestScriptSessionKey($auth, $expires, $consumeWithin, $permittedReferrerRegex, $cookie, &$sessionKey)
 {
     $url = FatSecretAPI::$base . 'method=profile.request_script_session_key';
     if (!empty($auth['user_id'])) {
         $url = $url . '&user_id=' . $auth['user_id'];
     }
     if ($expires > -1) {
         $url = $url . '&expires=' . $expires;
     }
     if ($consumeWithin > -1) {
         $url = $url . '&consume_within=' . $consumeWithin;
     }
     if (!empty($permittedReferrerRegex)) {
         $url = $url . '&permitted_referrer_regex=' . $permittedReferrerRegex;
     }
     if ($cookie == true) {
         $url = $url . "&cookie=true";
     }
     $oauth = new OAuthBase();
     $normalizedUrl;
     $normalizedRequestParameters;
     $signature = $oauth->GenerateSignature($url, $this->_consumerKey, $this->_consumerSecret, $auth['token'], $auth['secret'], $normalizedUrl, $normalizedRequestParameters);
     $doc = new SimpleXMLElement($this->GetQueryResponse($normalizedUrl, $normalizedRequestParameters . '&' . OAuthBase::$OAUTH_SIGNATURE . '=' . urlencode($signature)));
     $this->ErrorCheck($doc);
     $sessionKey = $doc->session_key;
 }