本文整理汇总了PHP中LinkedIn::statistics方法的典型用法代码示例。如果您正苦于以下问题:PHP LinkedIn::statistics方法的具体用法?PHP LinkedIn::statistics怎么用?PHP LinkedIn::statistics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkedIn
的用法示例。
在下文中一共展示了LinkedIn::statistics方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SimpleXMLElement
?>
" id="<?php
echo LINKEDIN::_GET_TYPE;
?>
" value="revoke" />
<input type="submit" value="Revoke Authorization" />
</form>
<hr />
<h2 id="network">Your Network:</h2>
<h3 id="network_stats">Stats:</h3>
<?php
$response = $OBJ_linkedin->statistics();
if ($response['success'] === TRUE) {
$response['linkedin'] = new SimpleXMLElement($response['linkedin']);
echo "<pre>" . print_r($response['linkedin'], TRUE) . "</pre>";
} else {
// statistics retrieval failed
echo "Error retrieving network statistics:<br /><br />RESPONSE:<br /><br /><pre>" . print_r($response) . "</pre>";
}
?>
<hr />
<h3 id="network_connections">Your Connections:</h3>
<?php
$response = $OBJ_linkedin->connections('~/connections:(id,first-name,last-name,picture-url)?start=0&count=' . CONNECTION_COUNT);
示例2: linkedin_old
public static function linkedin_old()
{
$id = ESSBSocialFansCounterHelper::get_option('linkedin.id');
$account_type = ESSBSocialFansCounterHelper::get_option('linkedin.account_type', 'company');
$app_key = ESSBSocialFansCounterHelper::get_option('linkedin.app_key');
$app_secret = ESSBSocialFansCounterHelper::get_option('linkedin.app_secret');
$oauth_token = ESSBSocialFansCounterHelper::get_option('linkedin.oauth_token');
$oauth_token_secret = ESSBSocialFansCounterHelper::get_option('linkedin.oauth_token_secret');
if (empty($id) || empty($app_secret) || empty($app_key) || $account_type == 'profile' && (empty($oauth_token) || empty($oauth_token_secret))) {
return 0;
}
$opt = array('appKey' => $app_key, 'appSecret' => $app_secret, 'callbackUrl' => '');
$api = new LinkedIn($opt);
if ($account_type == 'company') {
$response = $api->company(trim('universal-name=' . $id . ':(num-followers)'));
} elseif ($account_type == 'group') {
$response = $api->group($id, ':(num-members)');
} else {
$api->setTokenAccess(array('oauth_token' => $oauth_token, 'oauth_token_secret' => $oauth_token_secret));
$response = $api->statistics($id);
}
if (false == $response['success']) {
return false;
}
$xml = new SimpleXMLElement($response['linkedin']);
$count = 0;
if ($account_type == 'company') {
if (isset($xml->{'num-followers'})) {
$count = current($xml->{'num-followers'});
}
}
if ($account_type == 'group') {
if (isset($xml->{'num-members'})) {
$count = current($xml->{'num-members'});
}
}
if ($account_type == 'profile') {
if (isset($xml->property)) {
$count = (string) $xml->property[0];
}
}
return $count;
}