Bonjour,

J'ai un envoie de formulaire qui arrive sur une page auquel j'essaie de répondre, mais j'ai un get_headers à vide !

Voici mon code :
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
 
                header('Content-Type: application/json');
                header('charset:utf-8');
                header('Content-Length: 200');
                header('Transfer-Encoding: chunked');
                header('HTTP/1.1 200 OK');
 
                http_response_code(200) ;
 
                $response = array() ;
                $response['type'] = 'comp_01' ;
                $response['seq'] = $seq ; 
                $response['epoch'] = time() ;
                $response['gtw info']['type'] = $gtw_type ;
                $response['gtw info']['id'] = $gtw_id;
                $json_response = json_encode($response) ;
                print_r($json_response, true);
 
                $file1 = 'réponse'.date('Y-m-d H:i:s').'.txt';
                file_put_contents($file1, print_r($json_response, true));
                // fichier réponse ok
                $file100 = 'headers'.date('Y-m-d H:i:s').'.txt';
                file_put_contents($file100, print_r(get_headers()));
                // fichier headers : il affiche 1
Auriez vous une idée ?

Merci,