Bonjour,

je souhaite me connecter à http://www.adcash.com/ via Curl puis aller sur la page statistiques pour récupérer le contenu de la page....

Pour le moment, j'arrive bien à me connecter (j'arrive à afficher le contenu d'un membre connecté) mais quand je me rends sur la seconde page, ça ne passe... je suis redirigé vers la page pour me connecter...

Apparemment je dois avoir un soucis de cookie, si quelqu'un a une idée , je prends :-)

Voici où j'en suis.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
<?php
 
 
 
$lien = 'https://www.adcash.com/login.php?action=1';
$postfields = array(
    'pseudo' => 'xxxxx',
    'password' => 'xxxxxxxx',
    'stayconnected' => 'on'
); 
$path_cookie = 'connexion_adcash.txt';
if (!file_exists(realpath($path_cookie))) touch($path_cookie);
 
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $lien);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
 
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_COOKIEJAR, realpath($path_cookie));  
 
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); // on évite d'afficher cette page, on y recherche que la récupération de la session
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE); // autorisation des redirections
 
 
 
 
if(curl_exec($curl) === false)
{
    echo 'Erreur Curl : ' . curl_error($curl);
}
else
{
    echo 'L\'opération s\'est terminée sans aucune erreur. Curl 1';
	$return = curl_exec($curl);
	echo $return;
 
}
curl_close($curl);
 
 
 
 
///////////////////////////////////////////////////
/////////////// Recup Panel ///////////////////////
///////////////////////////////////////////////////
 
 
 
$lien2 = 'http://www.adcash.com/panel/statistiques.php';
$curl2 = curl_init();
 
curl_setopt($curl2, CURLOPT_URL, $lien2);
curl_setopt($curl2, CURLOPT_COOKIEFILE, realpath($path_cookie));  
curl_setopt($curl2, CURLOPT_COOKIESESSION, true);
curl_setopt($curl2, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl2, CURLOPT_POST, false);
curl_setopt($curl2, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($curl2, CURLOPT_FOLLOWLOCATION, TRUE); // autorisation des redirections
 
 
if(curl_exec($curl2) === false)
{
    echo 'Erreur Curl2 : ' . curl_error($curl2);
}
else
{
    echo 'L\'opération s\'est terminée sans aucune erreur. Curl 2';	
	$return2 = curl_exec($curl2); 
}
$return2 = curl_exec($curl2);
curl_close($curl2); 
 
echo $return2;
unlink($path_cookie);   
 
?>
Si quelqu'un à une idée ou un début de piste, je suis preneur !

Merci à vous !