Bonjour chers membres, j'ai pour les besoin d'un projet de récupérer le résultat de la page :
https://cfsmsp.impots.gouv.fr/secavi...mmun/index.jsf
depuis une sorte d'api qui envoit a cette page les 2 valeures demandées

voici ce que j'ai fait mais ca ne donne rien de concluant!
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
81
82
83
84
85
86
 
<?php
 
$ref1 = $_GET['ref1'];
$ref2 = $_GET['ref2'];
 
$urlsite = "https://cfsmsp.impots.gouv.fr/secavis/faces/commun/index.jsf";
 
 
 
$headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
$headers[] = "Connection: close";
$headers[] = "Content-type: application/x-www-form-urlencoded, text/html";
$user_agent = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.10 (maverick) Firefox/3.6.17";
 
 
 
 
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,"https://cfsmsp.impots.gouv.fr/secavis/");
 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$response = curl_exec($ch);
curl_close($ch);
list($recheader, $body) = explode("\r\n\r\n", $response, 2);
$Jidpos   = strpos($recheader, 'JSESSIONID=');
$Jidpos1   = strpos($recheader, 'javax.faces.ViewStat');
//echo $Jidpos1;
$FindJId= substr($recheader, $Jidpos+11, strpos($recheader, ';',$Jidpos)-$Jidpos-11);
 
$fields = array(
   "j_id_7:spi" => $ref1,
   "j_id_7:num_facture" => $ref2,
   "j_id_7:j_id_l" => "Valider",
   "j_id_7_SUBMIT" => "1",
  "javax.faces.ViewStat" => "RxJe/1JKTJSr3aiM3H9DqZq0DrwqEXsY7Rw4eLRgEBsCF1IALJGqVgWTaQkiKbbdcGDWW774BWUCa/+j2CDznhw1/3bxJteY6ZCui66yNevhkej4xuyrFMte5KQnKORt9JZrOQ=="
);
 
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&';}
//rtrim($fields_string,'&');
 
$url="https://cfsmsp.impots.gouv.fr/secavis/faces/commun/index.jsf;jsessionid=".$FindJId;
echo $url."<br>";
//echo count($fields)."<br>";
 
$fields_string = substr($fields_string, 0, -1);
//echo $fields_string;
 
 
 
$ch = curl_init();
 
curl_setopt ($ch, CURLOPT_URL,$url);
  curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
 
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
 
$data=curl_exec ($ch); 
//echo $data;
//curl_close($ch);
 
 
try{
  $info = curl_getinfo($ch);
  $json = json_decode($data, true);
   if (FALSE === $data)
    throw new Exception(curl_error($ch), curl_errno($ch));
 
  } catch(Exception $e) {
 
   trigger_error(sprintf(
     'Curl failed with error #%d: %s',
     $e->getCode(), $e->getMessage()),
     E_USER_ERROR);
  }
 
 
 
?>
je suis pas douée en curl j'ai surement fait des bétises , si quelquun a une idée pour que ca fonctionne, merci beaucoup