我如何连接到我的网站并使用api。我将体重值发送到api并获取身体测量值。我将在哪里获得api代码。
$config['withings_settings']['widgets'] = 'TRUE';
$config['withings_settings']['enabled'] = 'TRUE';
$config['withings_settings']['consumer_key'] = 'c65e4bff78de924609d8cce4dce837f2d931e0f13e8d9dbcbbdcf6f0c97cd';
$config['withings_settings']['consumer_secret'] = 'ec75fc954c37b57c67f8bc0ee6f1226d78b22ded5f173e73fd331f78ef0';
$config['withings_settings']['social_connection'] = 'TRUE';
$config['withings_settings']['connections_redirect']= 'settings/connections/';
$config['withings_settings']['archive'] = '';
/* Sites */
$config['withings_sites'][] = array(
'url' => 'http://withings.com/',
'module' => 'withings',
'type' => 'remote',
'title' => 'Withings',
'favicon' => 'http://withings.com/favicon.ico'
);
class OAuth_Provider_Withings extends OAuth_Provider {
public $name = 'withings';
public $uid_key = 'user_id';
public function get_user_info(OAuth_Consumer $consumer, OAuth_Token $token)
{
// Create a new GET request with the required parameters
$request = OAuth_Request::forge('resource', 'GET', 'http://wbsapi.withings.net/measure?action=getmeas&userid=933243', array(
'oauth_consumer_key' => $consumer->key,
'oauth_token' => $token->access_token
));
// Sign the request using the consumer and token
$request->sign($this->signature, $consumer, $token);
$activities = $request->execute();
// Create a response from the request
return $activities;
}
}
无论用户提交了体重,我都需要从withings获得测量响应。我需要使用api的参考代码,我还需要访问步骤。因为我之前没有使用过它。
提前谢谢。
最佳答案
您可以检查我的github withings lib中的withings。我目前有getbody /活动措施。
我目前遇到的唯一问题是,当我尝试创建通知时,似乎创建得很好(我可以从withings收到我的网站上的请求),但是withings仍然给出了293代码。
https://github.com/huitiemesens/PHPoAuthLib
关于javascript - Withings API入门,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20121141/