function renren_api($method, $p, $request = 'POST', $renren_oauth = null)
{
    $ret = false;
    $sys_config = renren_enable();
    if ($sys_config) {
        $renren_oauth = $renren_oauth ? $renren_oauth : renren_oauth();
        if ($renren_oauth) {
            $url = 'http:/' . '/api.renren.com/restserver.do';
            $p['api_key'] = $sys_config['renren']['client_id'];
            $p['method'] = $method;
            $p['v'] = '1.0';
            $p['format'] = 'json';
            $p = renren_sign($p, $sys_config['renren']['client_secret']);
            if ('POST' == $request) {
                $ret = $renren_oauth->post($url, $p);
            } else {
                $ret = $renren_oauth->get($url, $p);
            }
        }
    }
    return $ret;
}
Exemple #2
0
 function _init_renren_oauth($access_token = null)
 {
     $this->renrenOauth = renren_oauth($access_token);
 }