Merci d'avance pour votre aide.
J'essaye de me connecter à Linkedin via un petit script PHP afin de récupérer automatiquement des infos sur mon compte que je ne peux pas récupérer via l'API.
Je n'arrive malheureusement pas à passer la page d'authentification au début. Savez vous ce qui cloche dans mon code ?
<?php
$username = 'myEmail';
$password = 'myPassword';
$loginUrl = 'https://www.linkedin.com/uas/login';
//init curl
$ch = curl_init();
//Set the URL to work with
curl_setopt($ch, CURLOPT_URL, $loginUrl);
// ENABLE HTTP POST
curl_setopt($ch, CURLOPT_POST, 1);
//Set the post parameters
curl_setopt($ch, CURLOPT_POSTFIELDS, 'session_key-login='.$username.'session_password-login='.$password);
//Handle cookies for the login
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
//Setting CURLOPT_RETURNTRANSFER variable to 1
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//execute the request (the login)
$store = curl_exec($ch);
//Test if i'm logged in
$url = 'https://www.linkedin.com/profile/edit';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
?>
Merci de votre aide