-
Notifications
You must be signed in to change notification settings - Fork 0
/
getPhoto.php
executable file
·67 lines (46 loc) · 1.32 KB
/
getPhoto.php
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
63
64
65
66
67
<?php
session_start();
require("vendor/autoload.php");
$username = "brycelund13";
$password = "Welcome124";
//$client = new GuzzleHttp\Client(['cookies'=>true]);
$client = $_SESSION["myclient"];
//getAPIList();
//Authenticate();
$id = $_GET['id'];
$url = "https://www.lds.org/mobiledirectory/services/ludrs/1.1/photo/url/".$id."/individual";
$res = $client->request('GET', $url);
$response = $res->getBody();
$jsonlist = (array)json_decode($response);
$file = $jsonlist["largeUri"];
echo "<img src='".$file."' />";
//$type = 'image/jpeg';
//header('Content-Type:'.$type);
//readfile($file);
/*
function getAPIList(){
global $API_endpoints;
$json_list = file_get_contents("https://tech.lds.org/mobile/ldstools/config.json");
$API_endpoints = (array) json_decode($json_list);
}
function Authenticate(){
global $client, $API_endpoints, $username, $password;
$authurl = $API_endpoints["auth-url"];
$res = $client->request('POST', $authurl,
array(
'form_params' => [
'username' => $username,
'password' => $password
]
));
if($res->getStatusCode() == "200"){
//echo $res->getStatusCode();
//echo $res->getBody();
return true;
}else{
//echo $res->getStatusCode();
//echo $res->getBody();
return false;
}
}*/
?>