-
Notifications
You must be signed in to change notification settings - Fork 1
/
list.php
123 lines (95 loc) · 2.41 KB
/
list.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
$TITLE="List";
require_once "header.php";
require_once "mysqli_connect.php";
?>
<?php
$sql = "SELECT * FROM CMPE272.user_info;";
if (mysqli_query($conn, $sql)) {
;
} else {
echo "SELECT ERROR: $sql" . mysqli_error($conn);
}
if ($result = mysqli_query($conn, $sql)) {
echo "
<div class=\"container\">
<table class=\"table table-striped table-hover\">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Home Address</th>
<th>Home Phone</th>
<th>Cell Phone</th>
</tr>
</thead>
<tbody>";
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo "
<tr>
<td>" . $row["first_name"] . "</td>
<td>" . $row["last_name"] . "</td>
<td>" . $row["email"] . "</td>
<td>" . $row["home_address"] . "</td>
<td>" . $row["homephone"] . "</td>
<td>" . $row["cellphone"] . "</td>
</tr>";
}
}
echo "
</tbody>
</table>
</div>";
}
?>
<?php
require_once "simple_html_dom.php";
require_once "header.php";
//step1
$cSession = curl_init();
curl_setopt($cSession,CURLOPT_URL,"http://davidmhou.com/searchuser.php");
curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
curl_setopt($cSession,CURLOPT_HEADER, false);
$result=curl_exec($cSession);
$dom = new simple_html_dom();
$dom->load($result);
$dom->preserveWhiteSpace = false;
echo "
<div class=\"container\">
<table class=\"table table-striped table-hover\">
<tbody>";
$rows = $dom->find('tr');
foreach ($rows as $row) {
echo $row;
}
echo "
</tbody>
</table>
</div>";
curl_setopt($cSession,CURLOPT_URL,"http://lasertonesanjose.com/CMPE272/cURLlab/list_of_users_B.php");
curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
curl_setopt($cSession,CURLOPT_HEADER, false);
$result=curl_exec($cSession);
$dom = new simple_html_dom();
$dom->load($result);
$dom->preserveWhiteSpace = false;
echo "
<div class=\"container\">
<table class=\"table table-striped table-hover\">
<tbody>";
$rows = $dom->find('tr');
foreach ($rows as $row) {
echo "
$row
";
}
echo "
</tbody>
</table>
</div>";
curl_close($cSession);
?>
<?php require_once "footer.php"; ?>