-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathget-categories.php
More file actions
44 lines (33 loc) · 1015 Bytes
/
Copy pathget-categories.php
File metadata and controls
44 lines (33 loc) · 1015 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
require_once("knowem-api-client-2.0.php");
/*
*
* GET ALL SOCIAL NETWORK CATEGORIES
*
* This makes a call to http://knowem.com/api2.0/categories/<ID>/<KEY>
* and returns an array with all the possible categories and their IDs in it.
*
*/
$yourID = "<YOUR ID>";
$yourUsername = "<YOUR USERNAME>";
$yourPassword = "<YOUR PASSWORD>";
$yourAPIKey = "<YOUR API KEY>";
$yourAppName = "<YOUR UNIQUE APPLICATION NAME TO IDENTIFY YOURSELF>";
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Get All Categories</title>
</head>
<body>
<h4>Click on any category to get a list of all social networks within that category</h4>
<?php
$apiObj = new knowemAPI($yourID, $yourUsername, $yourPassword, $yourAPIKey, $yourAppName);
$categoriesArray = $apiObj->getAllCategories();
foreach ($categoriesArray['response'] as $catId => $catInfoArray) {
echo "<p><a href='get-networks-by-category.php?id=" . $catId . "'>" . $catInfoArray['title'] . "</a></p>\n";
}
?>
</body>
</html>