Update Status on LinkedIn using PHP
LinkedIn (www.linkedin.com) is one of the famous professional social network in the world. They connect many professionals around the world through their network. One of nice feature on LinkedIn is you can update status message. They called it ‘What are you working on?’. Here is simple PHP code that can update status message on your LinkedIn account. This code is using PHP libcurl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | <?php // script name: update_linkedin_status.php // coder: Sony AK Knowledge Center - www.sony-ak.com // set linkedin credentials $linkedInUsername = "your_linkedin_email_account"; $linkedInPassword = "your_linkedin_password"; // login to linkedin $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://m.linkedin.com/session"); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_POSTFIELDS, "login=" . $linkedInUsername . "&password=" . $linkedInPassword . "&commit=Sign+In"); curl_setopt($curl, CURLOPT_ENCODING, ""); curl_setopt($curl, CURLOPT_COOKIEJAR, getcwd() . '/cookies_linkedin.cookie'); $curlData = curl_exec($curl); curl_close($curl); // update your linkedin status $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "http://m.linkedin.com/network_updates"); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, "status=at office now...&commit=Save"); curl_setopt($curl, CURLOPT_ENCODING, ""); curl_setopt($curl, CURLOPT_COOKIEFILE, getcwd() . '/cookies_linkedin.cookie'); curl_setopt($curl, CURLOPT_COOKIEJAR, getcwd() . '/cookies_linkedin.cookie'); $curlData = curl_exec($curl); curl_close($curl); echo "Done!"; ?> |
Save it as update_linkedin_status.php. The logic is simple, actually we only simulate login to the LinkedIn mobile version and change the status from there. Below is the sample result on the LinkedIn profile.
If you have any difficulty, please send comment below or drop us e-mail to info@sony-ak.com.






he..he.., gak ada yang pake bahasa indonesia nya ya…, artikelnya penting. tp agak kurang ngerti apalagi pake bahasa inggris istilah..
benarx tertarik bngt artikelx nie… tp g da yg basa jawa jd tambah binngung dah….
we have a question how do we apply your script? pls explain deeper with example, becauxe we are not good enough in computer program (gaptek nih). thanks
I have a very similar script for use with Twitter. That one works fine, but I can’t get this one to update my status on LinkedIn. I changed username to my LI email address and password is correct. I left the status message alone just to test. What else would I need to do for this to update?
Thanks,
Tim
i think yahoo changed the steps required to send a message. b/c im getting an error on line 94.
Fatal error: Call to a member function getAttribute() on a non-object in /websites/dev/bots/yahoo/yim.php on line 94
It looks like its due to the location not existing on the page, it returned from the previous call. Any idea on a fix?
Thanks,
Chris
Thanks for these step to update linkedin status…
It would be great if you can provide the step to login http://www.linkedin.com/ using curl
@Pravin actually the step to login is already there for the mobile version, but hey, I will create it also for the web version… just wait…