Файловый менеджер - Редактировать - /home/pressec/www/presselib/anjljson/auth_token_et2.php
Назад
<?php header('Content-Type: application/json'); header("Content-Type: text/html; charset=UTF-8"); //connexion // Demander un jeton d'accès pour l'application $jeton = ''; $AuthCode ='MjdfYWpsNjRAcHJlc3NlbGliLmNvbTpoeDE0NXN1b2J6NzRpNjZndjBqb2psOXBseWk3b3lsYWtpaDVrc3oxcHNoY3o5NzYzZQ=='; $url = 'HTTPS://PORTAIL.ACTULEGALES.FR/OAUTH/V2/TOKEN'; $datas = array( 'grant_type' => 'authorization_code', 'code' => $AuthCode , 'username' => 'ajl@presselib.com', 'password' => '64PLBAjl2020852', 'grant_type' => 'password', 'scope' => 'user', ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $datas); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 3600); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $result_json = curl_exec($ch); $result = json_decode($result_json, true); $token = $result['access_token']; //reponse $reponse = var_dump(http_response_code()); //curl_close($ch); echo $reponse; ?> <?php $url = "https://public-api.infolegale.fr/annoncelegale/"; $content = json_encode(' { "newspaperId": 99846, "parutionDate": "2020-04-10", "departementParution": 65, "siren": 532083136, "companyName": "SERVER PARTNERS", "companyAddress": "8 IMPASSE DES EDELWEISS", "companyZip": 65200, "companyCity": "ARGELÈS-BAGNÈRES", "text": "En date du 03/04/2020, l\'associé unique a décidé le transfert du siège social à compter du 04/04/2020 et de modifier l\'article ART 4 des statuts comme suit : - Ancienne mention : le siège social de la société est fixé au 8 IMPASSE DES EDELWEISS, 65200 ARGELÈS-BAGNÈRES. - Nouvelle mention : le siège social de la société est fixé au 7 RUE HENRI BELLEVUE, 65000 TARBES. L\'inscription modificative sera portée au RCS de TARBES tenue par le greffe du tribunal. SERGE VERMEULEN POUR VER HOLDING" } '); echo $content; echo"<br>---------<br>"; /* CONVERSION UTF-8 */ echo utf8_encode( $content ); /* FIN CONVERSION UTF-8 */ $curl = curl_init($url); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json")); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $content); //$json_response = curl_exec($curl); echo"<br>---------<br>"; $status = curl_getinfo($curl, CURLINFO_HTTP_CODE); if ( $status != 201 ) { die("Error: call to URL $url failed with status $status, response $json_response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl)); } if ( $status == 401 ) { echo $curl."<br>401 Error Unauthorized. nok"; } if ( $status == 400 ) { echo $curl."<br>400 Invalid input. nok"; } if ( $status == 404 ) { echo $curl."<br>404 Ressource not found. nok"; } if ( $status == 201 ) { echo $curl."<br>201 Ressource Ad. ok"; } curl_close($curl); $response = json_decode($json_response, true); ?>
| ver. 1.4 |
Github
|
.
| PHP 5.6.40 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка