$ln->fetch("POST","/v1/groups/1483367/posts", "")
I am new to linkedin Api i am not understanding how the things are working in linkedin api.
Linkedin share code is below i come to know how this is working as below but i need to know how to work with group post(i am already a member of that group and i am login to linkedin while posting my post to group)
$ln->fetch('POST','/v1/people/~/shares',
array(
'comment' => 'Hello Linkedin',
'content' => array(
'title' => 'SimpleLinkedIn (SLinkedin)',
'description' => 'Open source OAuth2 Implementation for PHP and linkedin.',
'submittedUrl' => 'https://github.com/EJTH/SLinkedIn/'
),
'visibility' => array('code' => 'anyone' )
)
));
This page describes how to POST to a LinkedIn group that the authenticated user is a member of: https://developer.linkedin.com/documents/groups-api#create
Related
How to get Comments, Shares and Likes count of the post from linkedin Page using PHP
Using below code i posted posts on linkedIn Page,
include 'simplelinkedin.class.php';
$ln = new SimpleLinkedIn('ket', 'secret');
$ln->addScope('rw_nus');
if($ln->authorize()){
echo "<pre>";
print_r ($ln->fetch('POST','/v1/people/~/shares',
array(
'comment' => 'Hello Linkedin',
'content' => array(
'title' => 'test post',
'description' => 'test post comment ',
'submittedUrl' => 'http://www.google.com'
),
'visibility' => array('code' => 'anyone' )
)
));
}
for the above code i get key...
stdClass Object
(
[updateKey] => UNIU-103511686-5821126484735057920-SHARE
[updateUrl] => http://www.linkedin.com/updates?discuss=&scope=103511686&stype=M&topic=5821126484735057920&type=U&a=TpZB
)
Can anybody help me how to get Total Counts and Comments for the posts
Thanks!
Please refer to the following URL, I am using this for my ruby client and able to get likes and comments count using the API, when i pass the share ID.
API Reference - http://developer.linkedin.com/documents/commenting-reading-comments-and-likes-network-updates
I'm trying to fetch emails from gmail using PHP and CodeIgniter, and an OAuth2 library. I have already got OAuth2 set up to get the users access token, etc. I can get the users info by doing
public function get_user_info(OAuth2_Token_Access $token)
{
$url = 'https://www.googleapis.com/oauth2/v1/userinfo?alt=json&'.http_build_query(array(
'access_token' => $token->access_token,
));
$user = json_decode(file_get_contents($url), true);
return array(
'uid' => $user['id'],
'nickname' => url_title($user['name'], '_', true),
'name' => $user['name'],
'first_name' => $user['given_name'],
'last_name' => $user['family_name'],
'email' => $user['email'],
'location' => null,
'image' => (isset($user['picture'])) ? $user['picture'] : null,
'description' => null,
'urls' => array(),
);
}
What I want to do now is fetch some emails. I've googled for some code on how to get emails but the only thing I can see is https://mail.google.com/mail/feed/atom/. I found this on the Google OAuth2 Playground but I can't figure out how to use it apart from navigating to it directly.
Can anyone give me some suggestions? Ideally I want to fetch emails that are not just new (this seems to be what the link above does).
Using a REST-based interface you can currently only get the unread messages feed. If you want to access all emails of a user, you have to use IMAP. Google developed a method to do IMAP/SMTP authentication using OAuth2 that you can use.
I'm doing a facebook app and it was working good till yesterday. I did was let user's choose 20 of their friends and wrote a simple script to post to their wall from a loop like this:
foreach($selectedids as $selectedid) {
$invitation = new Invitations();
$invitation->circle_id = $circle->id;
$invitation->status = 0;
$invitation->follower_id = $selectedid;
if ($invitation->create()) {
$id = $invitation->id;
// Now Send the Invitations on Facebook
$facebook->api($selectedid.'/feed', 'post', array(
'picture' => '',
'message' => $name."something",
'name' => $config['app_title'],
'link' => $config['redirect_uri']."?invitation=".$id,
'caption' => '',
'description' => '',
'actions' => array(array('name' => 'Get Search',
'link' => 'http://www.google.com'))
));
}
}
Till yesterday everything was fine but when now multiple user's use this at once the script would stop after a post to about 7-8 friend and give an error that it couldn't complete task. Is there a better way to post to multiple peoples in facebook? What shall I do, would make this perform better? Any suggestions would be much appreciated.
Checking log an exception: 'error 201 user not visible' was found.
Thanks in advance.
How about puting the api call into a variable and checking the variable.?
$result = $facebook->api($selectedid.'/feed', 'post', array(
'picture' => '',
'message' => $name."something",
'name' => $config['app_title'],
'link' => $config['redirect_uri']."?invitation=".$id,
'caption' => '',
'description' => '',
'actions' => array(array('name' => 'Get Search',
'link' => 'http://www.google.com'))
));
Because if it is successfull, it will send you back the id of the post.
The error was due the user not being able to post to his friends wall which I solved by doing a check before posting by running a fql to check 'can_post' to user's friends wall. Solution can be viewed at.
Check if a facebook user can post in his friends wall or not
I have requirement that whatever I store on server database (like adding new question), it should auto publish to application's wall so that users who likes application can see regular updates.
How is it possible using PHP?
Any answer would be appreciated.
Thanks in advance.
You have to set a listener that will read the new changes on db or from the interface where u are setting the data for the database call the fb api and post it inmediatly... in that case would be something like this.
$autpost = array('message' => ' message',
'name' => 'This is my demo',
'caption' => "Caption ",
'link' => 'http://facebook.com',
'description' => 'description',
'picture' => 'http://somesite.picture.jpg',
'actions' => array(array('name' => 'Get Search',
'link' => 'http://www.google.com'))
);
$result = $facebook->api('/fanpage id/feed/', 'post', $wall_post);
How do I post to friend's wall using PHP Graph API? I got some javascript solutions. But I need PHP ones. Thank you.
Check the documentation here http://developers.facebook.com/docs/reference/api/post/.
Try $facebook->api('/Friend_ID/feed','post',array('message'=$message));. Refer to the documention for more parameters.
it requires few things
Create a Facebook Application: FB Documentation
Request extended permissions to access a user's photos and their friend's photos Facebook Auth / Permissions
FQL + JSDK to request the data JSDK Doc
$attachment = array('message' => 'this is my message',
'name' => 'This is my demo Facebook application!',
'caption' => "Caption of the Post",
'link' => 'http://mylink.com',
'description' => 'this is a description',
'picture' => 'http://mysite.com/pic.gif',
'actions' => array(array('name' => 'Get Search',
'link' => 'http://www.google.com'))
);
$result = $facebook->api('/me/feed/',
'post',
$attachment);
good luck