-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearchTables.php
50 lines (43 loc) · 2.32 KB
/
searchTables.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
<?php
function searchUser($name){
$name = str_replace(' ', '+', $_GET['search_result']);
echo $name;
$url="https://api.instagram.com/v1/users/search?q={$name}&access_token=".accessToken;
$get = connectToInstagram($url);
$obj = json_decode($get, true, 512);
$isValid = $obj['meta']['code'];
$length = count($obj['data']);
if($get){
echo "<div class='search-result'>";
echo "<table class='table'>";
echo "<thead class='hidden-xs'><tr>";
echo "<th>@Users</th>";
echo "</tr></thead>";
echo "<tbody>";
/*Show user profile data (pics, comments etc.)*/
for($i=0; $i<$length; $i++){
$profile_username = $obj['data'][$i]['username'];
$profile_picture = $obj['data'][$i]['profile_picture'];
$profile_full_name = $obj['data'][$i]['full_name'];
echo "<tr><th>";
echo "<div class='profile-picture'>";
echo "<a href='/instafeed/profile.php?username={$profile_username}'><img src='".$profile_picture."' alt='".$profile_username."' class='img-circle' height='42' width='42'></a>";
echo "</div>";
echo "<div class='search-user'>";
echo "<a href='/instafeed/profile.php?username={$profile_username}'><p class='taskDescription'>@".$profile_username."</a>";
if($profile_full_name){
echo "<i> (".$profile_full_name.")</i></p>";
}else{
echo "</p></a>";
}
echo "</div>";
echo "</th></tr>";
}
echo "</tbody>";
echo "</table>";
echo "</div>";
}else if($get === FALSE){
echo "Error 404. Please try searching something else.";
}
}
?>