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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| require_once('./cUrl-linkedin/include/SimpleHtmlDom/simple_html_dom.php');
session_start();
/** On récupère csrfTokenValue et sourceAliasValue **/
$html = file_get_html("https://www.linkedin.com/uas/login");
foreach($html->find('input#csrfToken-login') as $e)
$csrfTokenValue = $e->value;
foreach($html->find('input#sourceAlias-login') as $e)
$sourceAliasValue = $e->value;
//echo "<h5>".$csrfTokenValue."</h5>";
//echo "<h5>".$sourceAliasValue."</h5>";
/** On se connecte à linked in **/
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://www.linkedin.com/uas/login-submit');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//cookie
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
$path_cookie = 'cookie.txt';
if (!file_exists(realpath($path_cookie))) touch($path_cookie);
curl_setopt($curl, CURLOPT_COOKIEJAR, realpath($path_cookie));
//proxy
curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, true);
curl_setopt($curl, CURLOPT_PROXY, "195.229.241.17:8080");
//useragent
$user_agent = 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; ja; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11';
curl_setopt($curl, CURLOPT_USERAGENT, $user_agent);
//post
curl_setopt($curl, CURLOPT_POST, true);
$postfields = array(
'csrfToken' => $csrfTokenValue,
'hr' => '',
'isJsEnabled' => 'false',
'session_key' => 'tamazyy@laposte.net',
'session_password' => PASSWORD,
'session_redirect' => '',
'signin' => 'S%27identifier',
'sourceAlias' => $sourceAliasValue,
'source_app' => ''
);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
curl_exec($curl);
/** On essaye d'acceder a nhome **/
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://www.linkedin.com/nhome');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//cookie
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
$path_cookie = 'cookie.txt';
curl_setopt($curl, CURLOPT_COOKIEFILE, realpath($path_cookie));
//proxy
curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, true);
curl_setopt($curl, CURLOPT_PROXY, "195.229.241.17:8080");
//useragent
$user_agent = 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; ja; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11';
curl_setopt($curl, CURLOPT_USERAGENT, $user_agent);
//post
curl_setopt($curl, CURLOPT_POST, true);
$postfields = array(
'csrfToken' => $csrfTokenValue,
'hr' => '',
'isJsEnabled' => 'false',
'session_key' => 'tamazyy@laposte.net',
'session_password' => PASSWORD,
'session_redirect' => '',
'signin' => 'S%27identifier',
'sourceAlias' => $sourceAliasValue,
'source_app' => ''
);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
echo "->".curl_exec($curl)."<-"; |
Partager