-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheuropeana.php
More file actions
62 lines (52 loc) · 1.54 KB
/
europeana.php
File metadata and controls
62 lines (52 loc) · 1.54 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
58
59
60
61
62
<?php
include 'functions.php';
include 'keys.php';
$q = format(clean($_GET['q']));
$path = "http://europeana.eu/api/v2/search.json?wskey=$europeana_key&query=$q&rows=0&profile=facets";
$records = get_records($path);
$data = json_decode($records, true);
$values = array();
$languages = $data['facets'][1]['fields'];
$types = $data['facets'][2]['fields'];
$years = $data['facets'][3]['fields'];
$providers = $data['facets'][4]['fields'];
$countries = $data['facets'][6]['fields'];
$rights = $data['facets'][7]['fields'];
$i = 0;
foreach($languages as $language) {
$values[$i]['term'] = $language['label'];
$values[$i]['count'] = $language['count'];
$values[$i]['type'] = 'Language';
$i++;
}
foreach($types as $type) {
$values[$i]['term'] = $type['label'];
$values[$i]['count'] = $type['count'];
$values[$i]['type'] = 'Type';
$i++;
}
foreach($years as $year) {
$values[$i]['term'] = $year['label'];
$values[$i]['count'] = $year['count'];
$values[$i]['type'] = 'Year';
$i++;
}
foreach($providers as $provider) {
$values[$i]['term'] = $provider['label'];
$values[$i]['count'] = $provider['count'];
$values[$i]['type'] = 'Provider';
$i++;
}
foreach($countries as $country) {
$values[$i]['term'] = $country['label'];
$values[$i]['count'] = $country['count'];
$values[$i]['type'] = 'Country';
$i++;
}
foreach($rights as $right) {
$values[$i]['term'] = $right['label'];
$values[$i]['count'] = $right['count'];
$values[$i]['type'] = 'Rights';
$i++;
}
echo json_encode($values);