Projet

Général

Profil

Se connecter à l'API DoliSCAN depuis Dolibarr » Historique » Version 1

Eric Seigne, 05/07/2020 16:06

1 1 Eric Seigne
# Se connecter à l'API DoliSCAN depuis Dolibarr
2
3
Premier test aujourd'hui un peu brutal qui marche:
4
5
```
6
        $token = "w0ymfx2UWsazq1JtUWDrC1l0HNxJOl9BqLVtOqk83Z82aCwvVfDtlBBKo5Y6";
7
        $headers = [
8
                    'Authorization' => 'Bearer ' . $token,
9
                    'Accept'        => 'application/json',
10
                    ];
11
12
        $client = new GuzzleHttp\Client([
13
                                              'base_uri' => 'http://192.168.16.15/',                                                                                                                                                                                                                                      
14
                                              'timeout'  => 2.0,
15
                                              'headers'  => $headers,
16
                                              ]);
17
18
        $response = $client->request('POST', 'api/ping', [
19
                                                          'json' => ['email' => 'tar@cap-rel.fr']
20
                                                          ]);
21
        //        xhr.setRequestHeader('Authorization', 'Bearer ' + localGetData("api_token"));                                                                                                                                                                                                                           
22
23
        print_r($response);
24
25
```
Go to top
Ajouter une image à partir du presse-papier (Taille maximale: 50 Mo)