Your IP : 216.73.216.186


Current Path : /home/pressec/www/presselib/anjljson/
Upload File :
Current File : /home/pressec/www/presselib/anjljson/auth_token_et1.1.php

<?php
//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-06",
  "departementParution": 32,
  "siren": 0,
  "companyName": "MPRENOVAZ",
  "companyAddress": "110 rue de Metz",
  "companyZip": 32000,
  "companyCity": "AUCH",
  "text": "Aux termes d\'un ASSP en date du 13/01/2020, il a été constitué une SASU ayant les caractéristiques suivantes : Dénomination : MPRENOVAZ. Objet social : Tous types de décorations et travaux d’intérieur. Siège social : 110 rue de Metz,  Chez Mme POKEE, 32000 AUCH. Capital : 10 €. Durée : 99 ans à compter de son immatriculation au RCS d\'AUCH. Président : Madame POKEE MICHELE, demeurant 110 RUE DE METZ, 32000 AUCH. Admission aux assemblées et droits de votes : chaque action donne droit à une voix. Clause d\'agrément : Les actions sont librement négociables. MICHELE POKEE"
}



');

$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);

$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>Error Unauthorized. nok";
}
if ( $status == 400 ) {
    echo $curl."<br>Invalid input. nok";
}
if ( $status == 404 ) {
    echo $curl."<br>Ressource not found. nok";
}
curl_close($curl);

$response = json_decode($json_response, true);


?>