php url http api randomuser me text file_get_contents url array json_d

 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
<?php
$url = "http://api.randomuser.me/";
$text = file_get_contents($url);
$array = json_decode($text, true);
$array = $array["results"][0];
?>
<html>
<head>
<title>Я дибіл</title>
<head>
<body>
<h1>Таблица</h1>
<table border='1'>
<tr>
<th>Имя</th>
<th>Фамилия</th>
<th>Пол</th>
<th>Город</th>
<th>Штат</th>
<th>Эл.почта</th>
<th>Телефон</th>
<th>Логин</th>
<th>Пароль</th>
</tr>
<tr>
<td><?php print $array["user"]["name"]["first"]; ?></td>
<td><?php print $array["user"]["name"]["last"]; ?></td>
<td><?php print $array["user"]["gender"]; ?></td>
<td><?php print $array["user"]["location"]["city"]; ?></td>
<td><?php print $array["user"]["location"]["state"]; ?></td>
<td><?php print $array["user"]["email"]; ?></td>
<td><?php print $array["user"]["phone"]; ?></td>
<td><?php print $array["user"]["username"]; ?></td>
<td><?php print $array["user"]["password"]; ?></td>
</tr>
</table>
</body>
</html>