LinkedIn API Automated Posting
Free API provided by LinkedIn itself is limited to personal pages and groups only. You can’t post to LinkedIn Company Pages using free built-in LinkedIn API.
NextScripts API for LinkedIn adds the ability to make automated posts LinkedIn Company pages and LinkedIn Groups. NextScripts API for LinkedIn is included to the Social Networks Auto Poster PRO Plugin version 2.2 or later.
Usage
The script is very easy to use.Example:
Please note, those examples are for using SNAP API directly from PHP. if you are looking for auto-posting from WordPress to LinkedIn you just need the SNAP Pro WordPress plugin. SNAP API Run-Time is built in the SNAP Pro WordPress plugin. No PHP coding is necessary with WordPress.
1. Post text message with attached link to your LinkedIn Company Page:
<?php require_once "nxs-api/nxs-api.php"; require_once "nxs-api/nxs-http.php"; require_once "inc/nxs-functions.php"; $email = 'YourEmail@gmail.com'; $pass = 'YourPassword'; $msg = 'Post this to LinkedIn Company Page'; $to = 'https://www.linkedin.com/company/MySuperCompany'; $lnkArr['postType'] = 'A'; $lnkArr['url'] = 'http://www.nextscripts.com/'; $nt = new nxsAPI_LI(); $loginError = $nt->connect($email, $pass); if (!$loginError) { $result = $nt -> post($msg); } else echo $loginError; if (!empty($result) && is_array($result) && !empty($result['post_url'])) echo '<a target="_blank" href="'.$result['post_url'].'">New Post</a>'; else echo "<pre>".print_r($result, true)."</pre>"; ?>