当前位置: 首页>>代码示例>>PHP>>正文


PHP oauth_client_class::CallAPI方法代码示例

本文整理汇总了PHP中oauth_client_class::CallAPI方法的典型用法代码示例。如果您正苦于以下问题:PHP oauth_client_class::CallAPI方法的具体用法?PHP oauth_client_class::CallAPI怎么用?PHP oauth_client_class::CallAPI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oauth_client_class的用法示例。


在下文中一共展示了oauth_client_class::CallAPI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: die

$client->client_id = '';
$application_line = __LINE__;
$client->client_secret = '';
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please go to Yandex developer applications page ' . 'https://oauth.yandex.com/client/new , create a new application ' . 'and in the line ' . $application_line . ' set the client_id to Application ID and client_secret with Application password. ' . 'The callback URL must be ' . $client->redirect_uri);
}
/* API permissions
 */
$client->scope = '';
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->authorization_error)) {
            $client->error = $client->authorization_error;
            $success = false;
        } elseif (strlen($client->access_token)) {
            $success = $client->CallAPI('https://login.yandex.ru/info?format=json', 'GET', array(), array('FailOnAccessError' => true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    exit;
}
if ($success) {
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Yandex OAuth client results</title>
</head>
<body>
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:31,代码来源:login_with_yandex.php

示例2: dirname

$client->debug_http = true;
$client->server = 'Facebook';
$client->redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . dirname(strtok($_SERVER['REQUEST_URI'], '?')) . '/login_with_facebook.php';
$client->client_id = '134526290051121';
$application_line = __LINE__;
$client->client_secret = '8aef0e23031a9964381d8035fdf966c4';
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please go to Facebook Apps page https://developers.facebook.com/apps , ' . 'create an application, and in the line ' . $application_line . ' set the client_id to App ID/API Key and client_secret with App Secret');
}
/* API permissions
 */
$client->scope = 'email,publish_actions,user_friends';
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->access_token)) {
            $success = $client->CallAPI('https://graph.facebook.com/v2.3/me/friends', 'GET', array(), array('FailOnAccessError' => true), $user);
            /*
            				if($success)
            				{
            					// Get Friends that use the same application
            
            					$success = $client->CallAPI(
            						'https://graph.facebook.com/v2.3/me/friends', 
            						'GET', array(), array('FailOnAccessError'=>true), $friends);
            				}
            */
            if ($success) {
                // Requires publish_actions permissions and your application needs to be submitted for review
                $values = array('message' => '', 'link' => 'http://www.phpclasses.org/package/7700-PHP-Authorize-and-access-APIs-using-OAuth.html', 'description' => 'This post was submitted using this PHP OAuth API client class.', 'picture' => 'http://files.phpclasses.org/files/blog/package/7700/file/PHP%2BOAuth.png');
                /*
                $success = $client->CallAPI(
开发者ID:olivercieliszak,项目名称:orw,代码行数:31,代码来源:login_with_facebook.php

示例3: die

$client->client_id = CLIENT_ID;
$application_line = __LINE__;
$client->client_secret = CLIENT_SECRET;
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please go to Google APIs console page ' . 'http://code.google.com/apis/console in the API access tab, ' . 'create a new client ID, and in the line ' . $application_line . ' set the client_id to Client ID and client_secret with Client Secret. ' . 'The callback URL must be ' . $client->redirect_uri . ' but make sure ' . 'the domain is valid and can be resolved by a public DNS.');
}
/* API permissions
 */
$client->scope = SCOPE;
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->authorization_error)) {
            $client->error = $client->authorization_error;
            $success = false;
        } elseif (strlen($client->access_token)) {
            $success = $client->CallAPI('https://www.googleapis.com/oauth2/v1/userinfo', 'GET', array(), array('FailOnAccessError' => true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    exit;
}
if ($success) {
    // Now check if user exist with same email ID
    $sql = "SELECT COUNT(*) AS count from GoogleLogin where email = :email_id";
    try {
        $stmt = $DB->prepare($sql);
        $stmt->bindValue(":email_id", $user->email);
        $stmt->execute();
        $result = $stmt->fetchAll();
开发者ID:Gonxis,项目名称:TOMO2_Project,代码行数:31,代码来源:GoogleUsers.php

示例4: dirname

require 'oauth_client.php';
$client = new oauth_client_class();
$client->debug = 1;
$client->debug_http = 1;
$client->server = 'Tumblr';
$client->redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . dirname(strtok($_SERVER['REQUEST_URI'], '?')) . '/login_with_tumblr.php';
$client->client_id = '';
$application_line = __LINE__;
$client->client_secret = '';
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please go to Tumblr Apps page http://www.tumblr.com/oauth/apps , ' . 'create an application, and in the line ' . $application_line . ' set the client_id to Consumer key and client_secret with Consumer secret. ' . 'The Default callback URL must be ' . $client->redirect_uri);
}
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->access_token)) {
            $success = $client->CallAPI('http://api.tumblr.com/v2/user/info', 'GET', array(), array('FailOnAccessError' => true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    exit;
}
if ($success) {
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Tumblr OAuth client results</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
开发者ID:ghasedak,项目名称:openDCIM,代码行数:31,代码来源:login_with_tumblr.php

示例5: dirname

$client = new oauth_client_class();
$client->server = 'Google';
$client->offline = false;
$client->debug = false;
$client->debug_http = true;
$client->redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . dirname(strtok($_SERVER['REQUEST_URI'], '?')) . '/invite_gmail';
$client->client_id = 'googleClientID';
$client->client_secret = 'googleClientSecret';
$client->scope = 'https://www.google.com/m8/feeds/';
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->authorization_error)) {
            $client->error = $client->authorization_error;
            $success = false;
        } elseif (strlen($client->access_token)) {
            $success = $client->CallAPI('https://www.google.com/m8/feeds/contacts/default/full?max-results=2500', 'GET', array(), array('FailOnAccessError' => true), $data);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    $OP->ser("Something Happened", "<a href='" . $client->redirect_uri . "'>Try Again</a>");
}
if ($success) {
    $firstName = get("fname");
    $name = get("name", $who, false);
    $xml = new SimpleXMLElement($data);
    $xml->registerXPathNamespace('gd', 'http://schemas.google.com/g/2005');
    $result = $xml->xpath('//gd:email');
    foreach ($result as $title) {
        $email = $title->attributes()->address;
开发者ID:sankarganeshsiva,项目名称:open,代码行数:31,代码来源:invite_gmail.php

示例6: die

$client->client_id = '';
$application_line = __LINE__;
$client->client_secret = '';
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please go to StockTwits new application page ' . 'http://stocktwits.com/developers/apps/new and in the line ' . $application_line . ' set the client_id to Consumer key and client_secret with Consumer secret. ' . 'The site domain must have the same domain of ' . $client->redirect_uri);
}
/* API permissions
 */
$client->scope = 'read,watch_lists,publish_messages,publish_watch_lists,direct_messages,follow_users,follow_stocks';
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->authorization_error)) {
            $client->error = $client->authorization_error;
            $success = false;
        } elseif (strlen($client->access_token)) {
            $success = $client->CallAPI('https://api.stocktwits.com/api/2/account/verify.json', 'GET', array(), array('FailOnAccessError' => true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    exit;
}
if ($success) {
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>StockTwits OAuth client results</title>
</head>
<body>
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:31,代码来源:login_with_stocktwits.php

示例7: dirname

$client->debug_http = true;
$client->server = 'Misfit';
$client->redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . dirname(strtok($_SERVER['REQUEST_URI'], '?')) . '/login_with_misfit.php';
$client->client_id = '';
$application_line = __LINE__;
$client->client_secret = '';
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please go to Misfit Apps page https://developers.misfit.com/apps , ' . 'create an application, and in the line ' . $application_line . ' set the client_id to App ID/API Key and client_secret with App Secret');
}
/* API permissions
 */
$client->scope = 'email';
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->access_token)) {
            $success = $client->CallAPI('https://api.misfitwearables.com/move/resource/v1/user/me/profile', 'GET', array(), array('FailOnAccessError' => true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    exit;
}
if ($success) {
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Misfit OAuth client results</title>
</head>
<body>
开发者ID:olivercieliszak,项目名称:orw,代码行数:31,代码来源:login_with_misfit.php

示例8: dirname

$client->debug_http = true;
$client->server = 'Facebook';
$client->redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . dirname(strtok($_SERVER['REQUEST_URI'], '?')) . '/login_with_facebook.php';
$client->client_id = '';
$application_line = __LINE__;
$client->client_secret = '';
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please go to Facebook Apps page https://developers.facebook.com/apps , ' . 'create an application, and in the line ' . $application_line . ' set the client_id to App ID/API Key and client_secret with App Secret');
}
/* API permissions
 */
$client->scope = 'email,publish_actions,user_friends';
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->access_token)) {
            $success = $client->CallAPI('https://graph.facebook.com/v2.3/me', 'GET', array(), array('FailOnAccessError' => true), $user);
            /*
            				if($success)
            				{
            					// Get Friends that use the same application
            
            					$success = $client->CallAPI(
            						'https://graph.facebook.com/v2.3/me/friends', 
            						'GET', array(), array('FailOnAccessError'=>true), $friends);
            				}
            */
            if ($success) {
                // Requires publish_actions permissions and your application needs to be submitted for review
                $values = array('message' => '', 'link' => 'http://www.phpclasses.org/package/7700-PHP-Authorize-and-access-APIs-using-OAuth.html', 'description' => 'This post was submitted using this PHP OAuth API client class.', 'picture' => 'http://files.phpclasses.org/files/blog/package/7700/file/PHP%2BOAuth.png');
                $success = $client->CallAPI('https://graph.facebook.com/v2.3/me/feed', 'POST', $values, array('FailOnAccessError' => true), $post);
            }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:31,代码来源:login_with_facebook.php

示例9: die

$client->client_id = '';
$application_line = __LINE__;
$client->client_secret = '';
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please register a new RunKeeper application in ' . 'http://runkeeper.com/partner/applications/register , and in the line ' . $application_line . ' set the client_id to Client ID and ' . 'client_secret with Client Secret. ' . 'The callback URL must be ' . $client->redirect_uri . ' but make sure ' . 'it is a secure URL (https://).');
}
/* API permissions, empty is the default for this application
 */
$client->scope = '';
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->authorization_error)) {
            $client->error = $client->authorization_error;
            $success = false;
        } elseif (strlen($client->access_token)) {
            $success = $client->CallAPI('https://api.runkeeper.com/profile/', 'GET', array(), array('FailOnAccessError' => true, 'FollowRedirection' => true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    exit;
}
if ($success) {
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>RunKeeper OAuth client results</title>
</head>
<body>
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:31,代码来源:login_with_runkeeper.php

示例10: dirname

$client->debug = 0;
$client->debug_http = 1;
$client->server = 'Flickr';
$client->redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . dirname(strtok($_SERVER['REQUEST_URI'], '?')) . '/login_with_flickr.php';
$client->client_id = '';
$application_line = __LINE__;
$client->client_secret = '';
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please go to Flickr Apps page http://www.flickr.com/services/apps/create/ , ' . 'create an application, and in the line ' . $application_line . ' set the client_id to Key and client_secret with Secret.');
}
$client->scope = 'read';
// 'read', 'write' or 'delete'
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->access_token)) {
            $success = $client->CallAPI('http://api.flickr.com/services/rest/', 'GET', array('method' => 'flickr.test.login', 'format' => 'json', 'nojsoncallback' => '1'), array('FailOnAccessError' => true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    exit;
}
if ($success) {
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Flickr OAuth client results</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
开发者ID:kranthidashing,项目名称:php-oauth-api,代码行数:31,代码来源:login_with_flickr.php

示例11: dirname

require 'oauth_client.php';
$client = new oauth_client_class();
$client->debug = 1;
$client->debug_http = 1;
$client->server = 'Fitbit';
$client->redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . dirname(strtok($_SERVER['REQUEST_URI'], '?')) . '/login_with_fitbit.php';
$client->client_id = '';
$application_line = __LINE__;
$client->client_secret = '';
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please go to Fitbit application registration page https://dev.fitbit.com/apps/new , ' . 'create an application, and in the line ' . $application_line . ' set the client_id to Consumer key and client_secret with Consumer secret. ' . 'The Callback URL must be ' . $client->redirect_uri) . ' Make sure this URL is ' . 'not in a private network and accessible to the Fitbit site.';
}
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->access_token)) {
            $success = $client->CallAPI('https://api.fitbit.com/1/user/-/profile.json', 'GET', array(), array('FailOnAccessError' => true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    exit;
}
if ($success) {
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Fitbit OAuth client results</title>
</head>
<body>
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:31,代码来源:login_with_fitbit.php

示例12: elseif

     die;
 }
 // Define permisos de la API (si es necesario)
 if ($OAuth_Alcance != "") {
     $client->scope = $OAuth_Alcance;
 }
 if ($success = $client->Initialize()) {
     if ($success = $client->Process()) {
         // INICIO DEL PROCESAMIENTO POR SERVICIO
         // Google
         if ($OAuth_servicio == 'Google') {
             if (strlen($client->authorization_error)) {
                 $client->error = $client->authorization_error;
                 $success = false;
             } elseif (strlen($client->access_token)) {
                 $success = $client->CallAPI('https://www.googleapis.com/oauth2/v1/userinfo', 'GET', array(), array('FailOnAccessError' => true), $user);
             }
         }
         // Facebook
         if ($OAuth_servicio == 'Facebook') {
             if (strlen($client->access_token)) {
                 $success = $client->CallAPI('https://graph.facebook.com/me', 'GET', array(), array('FailOnAccessError' => true), $user);
             }
         }
         // LinkedIn
         if ($OAuth_servicio == 'LinkedIn') {
             if (strlen($client->access_token)) {
                 $success = $client->CallAPI('http://api.linkedin.com/v1/people/~', 'GET', array('format' => 'json'), array('FailOnAccessError' => true), $user);
             }
         }
         // Instagram
开发者ID:afgstec,项目名称:practico,代码行数:31,代码来源:ws_funciones.php

示例13: elseif

$client->scope = '';
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->authorization_error)) {
            $client->error = $client->authorization_error;
            $success = false;
        } elseif (strlen($client->access_token)) {
            /*
             * Requests just to get just the user details can be obtained
             * sending a request to the URL defined by the variable:
             * $client->access_token_response['id']
             *
             * Other API requests need to be sent to the base URL defined by:
             * $client->access_token_response['instance_url']
             */
            $success = $client->CallAPI($client->access_token_response['id'], 'GET', array(), array('FailOnAccessError' => true, 'FollowRedirection' => true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    exit;
}
if ($success) {
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Salesforce OAuth client results</title>
</head>
<body>
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:31,代码来源:login_with_salesforce.php

示例14: die

$client->client_id = '';
$application_line = __LINE__;
$client->client_secret = '';
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please go to Reddit preferences and apps page ' . 'https://ssl.reddit.com/prefs/apps , create a new application,' . ' and in the line ' . $application_line . ' set the client_id to' . ' application id below the title' . ' and client_secret with secret. ' . 'The callback URL must be ' . $client->redirect_uri);
}
/* API permissions
 */
$client->scope = 'identity';
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->authorization_error)) {
            $client->error = $client->authorization_error;
            $success = false;
        } elseif (strlen($client->access_token)) {
            $success = $client->CallAPI('https://oauth.reddit.com/api/v1/me.json', 'GET', array(), array('FailOnAccessError' => true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    exit;
}
if ($success) {
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Google OAuth client results</title>
</head>
<body>
开发者ID:zhuomingliang,项目名称:webmail-lite,代码行数:31,代码来源:login_with_reddit.php

示例15: die

$client->client_id = $linkedinApiKey;
$application_line = __LINE__;
$client->client_secret = $linkedinApiSecret;
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please go to LinkedIn Apps page https://www.linkedin.com/secure/developer?newapp= , ' . 'create an application, and in the line ' . $application_line . ' set the client_id to Consumer key and client_secret with Consumer secret. ' . 'The Callback URL must be ' . $client->redirect_uri) . ' Make sure you enable the ' . 'necessary permissions to execute the API calls your application needs.';
}
/* API permissions
 */
$client->scope = $linkedinScope;
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->authorization_error)) {
            $client->error = $client->authorization_error;
            $success = false;
        } elseif (strlen($client->access_token)) {
            $success = $client->CallAPI('http://api.linkedin.com/v1/people/~:(id,email-address,first-name,last-name,location,picture-url,public-profile-url,formatted-name)', 'GET', array('format' => 'json'), array('FailOnAccessError' => true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    exit;
}
if ($success) {
    $user_id = $db->checkUser($user);
    $_SESSION['loggedin_user_id'] = $user_id;
    $_SESSION['user'] = $user;
} else {
    $_SESSION["err_msg"] = $client->error;
}
header("location:index.php");
开发者ID:sagarsdeshmukh,项目名称:login-with-linkedin-using-php,代码行数:31,代码来源:process.php


注:本文中的oauth_client_class::CallAPI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。