-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpeople.php
More file actions
28 lines (22 loc) · 783 Bytes
/
people.php
File metadata and controls
28 lines (22 loc) · 783 Bytes
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
<?php
require_once 'Function.php';
header('Content-Type: text/xml');
function get_content(){
$url = 'https://api.github.com/repos/miw05/directory/contents/peoples.json';
$json = curl(TOKEN, $url);
$decode = base64_decode($json['content']);
$liste = json_decode($decode);
$fichXml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
$fichXml .= "<people>";
for ($i = 0; $i < sizeof($liste); $i++) {
$link = $liste[$i]->github;
if (substr($link, -1) == '/') {
$link = mb_substr($link, 0, -1);
}
$name = substr($link, strrpos($link, '/')+1);
$fichXml .= "<human><name>".$liste[$i]->name."</name><pseudo>".$name."</pseudo></human>";
}
$fichXml .= "</people>";
echo $fichXml;
}
get_content();