teste - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of teste.php

  1. <?php
  2.                 $curl = curl_init();
  3.  
  4.                 curl_setopt_array($curl, array(
  5.                     CURLOPT_URL => "https://apinforma.informadb.pt/v1/login",
  6.                     CURLOPT_RETURNTRANSFER => true,
  7.                     CURLOPT_ENCODING => "",
  8.                     CURLOPT_MAXREDIRS => 10,
  9.                     CURLOPT_TIMEOUT => 0,
  10.                     CURLOPT_FOLLOWLOCATION => true,
  11.                     CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  12.                     CURLOPT_CUSTOMREQUEST => "POST",
  13.                     CURLOPT_POSTFIELDS => "{\n\t\"userId\"\"546484\",\n\t\"password\"\"MXU4AG2QTN\"\n}",
  14.                     CURLOPT_HTTPHEADER => array(
  15.                         "Content-Type: application/json",
  16.                         "Content-Type: application/json"
  17.                     ),
  18.                 ));
  19.  
  20.                 $response = curl_exec($curl);
  21.                 curl_close($curl);
  22.                 $resposta = json_decode($response, true);
  23.                 $acess_token = $resposta['access_token'];
  24.                 ?>
File Description
  • teste
  • PHP Code
  • 23 Sep-2021
  • 1.05 Kb
You can Share it: