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.
Result of php executing
Full code of teste.php
- <?php
- $curl = curl_init();
- curl_setopt_array($curl, array(
- CURLOPT_URL => "https://apinforma.informadb.pt/v1/login",
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_ENCODING => "",
- CURLOPT_MAXREDIRS => 10,
- CURLOPT_TIMEOUT => 0,
- CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
- CURLOPT_CUSTOMREQUEST => "POST",
- CURLOPT_POSTFIELDS => "{\n\t\"userId\": \"546484\",\n\t\"password\": \"MXU4AG2QTN\"\n}",
- CURLOPT_HTTPHEADER => array(
- "Content-Type: application/json",
- "Content-Type: application/json"
- ),
- ));
- $response = curl_exec($curl);
- curl_close($curl);
- $resposta = json_decode($response, true);
- $acess_token = $resposta['access_token'];
- ?>