Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Controllers;
- use Illuminate\Http\Request;
- use GuzzleHttp\Client;
- class TestingController extends Controller
- {
- public function login()
- {
- $client = new Client();
- $url = "https://api.itats.ac.id/api/login-mahasiswa";
- $getResponse = $client->post($url,
- [
- 'headers' => [
- 'Accept' => 'application/json',
- ],
- 'json' => [
- 'name' => '06.2016.1.06628', //npm ku
- 'pass' => '06.2016.1.06628', //password sim
- ]
- ]);
- $response = json_decode($getResponse->getBody()->getContents(), true);
- dd($response);
- }
- public function mahasiswa()
- {
- $client = new Client();
- $token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvYXBpLml0YXRzLmFjLmlkXC9hcGlcL2xvZ2luLW1haGFzaXN3YSIsImlhdCI6MTY0ODY0NDI1NSwiZXhwIjoxNjQ4NjQ3ODU1LCJuYmYiOjE2NDg2NDQyNTUsImp0aSI6IkVvUGRMVG1xOWdtdkRSbXYiLCJzdWIiOjM3MDM1LCJwcnYiOiIyM2JkNWM4OTQ5ZjYwMGFkYjM5ZTcwMWM0MDA4NzJkYjdhNTk3NmY3In0.6EdBk4AtTtvgtvi-Dfsm-6BJ0PJVeuOGTALkEKvoEVU';
- $url = "https://api.itats.ac.id/api/profil-mahasiswa?token=" . $token;
- $getResponse = $client->get($url,
- [
- 'headers' => [
- 'Accept' => 'application/json',
- ]
- ]);
- $response = json_decode($getResponse->getBody(), true);
- dd($response['data']['mhsnama']);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment