-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdatabrowser.php
More file actions
57 lines (44 loc) · 1.83 KB
/
databrowser.php
File metadata and controls
57 lines (44 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
session_start();
//open connection
$ch = curl_init();
//https://api.sandbox.slcedu.org/api/rest/v1/studentSectionAssociations?studentId=2012al-b7019126-bcf8-11e1-8506-0247757a1887
$url = 'https://api.sandbox.slcedu.org/api/rest/v1/students'; ///2012an-b7022d67-bcf8-11e1-8506-0247757a1887';
//$url = 'https://api.sandbox.slcedu.org/api/rest/v1/students/2012an-b7022d67-bcf8-11e1-8506-0247757a1887/studentAssessments';
//$url = 'https://api.sandbox.slcedu.org/api/rest/v1/students/2012an-b7022d67-bcf8-11e1-8506-0247757a1887/studentParentAssociations';
//$url = 'https://api.sandbox.slcedu.org/api/rest/v1/students/2012an-b7022d67-bcf8-11e1-8506-0247757a1887/courseTranscripts/courses';
//$url = 'https://api.sandbox.slcedu.org/api/rest/v1/students';
$token = $_SESSION['access_token'];
$code = $_SESSION['code'];
$auth = sprintf('Authorization: bearer %s', $token);
//echo $auth;
$headers = array(
'Content-Type: application/vnd.slc+json',
'Accept: application/vnd.slc+json',
$auth);
curl_setopt($ch, CURLOPT_URL, $url);
//curl_setopt($ch, CURLOPT_HEADER, TRUE);
//curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, FALSE);
curl_setopt($ch, CURLOPT_HTTPGET, TRUE);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
if (DISABLE_SSL_CHECKS == TRUE) {
// WARNING: this would prevent curl from detecting a 'man in the middle' attack
// See note in settings.php
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
}
//execute post
$result = curl_exec($ch);
//echo '<br/><br/>' . print_r(curl_getinfo($ch));
//close connection
curl_close($ch);
header('Content-type: application/json');
echo $result;
die();
$json = json_decode($result);
//print_r($json);
//print_r($json[0]);
?>