-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·28 lines (27 loc) · 1.45 KB
/
index.php
File metadata and controls
executable file
·28 lines (27 loc) · 1.45 KB
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
<html>
<head>
<title>Built.io Contentstack PHP SDK</title>
</head>
<body>
<h1>Welcome to Contentstack PHP SDK</h1>
</body>
</html>
<?php
ini_set('display_errors', 'On');
use Contentstack\Contentstack;
include_once "../src/index.php";
$stack = Contentstack::Stack('<API-KEY>', '<ACCESS-TOKEN>', '<ENVIRONMENT>');
try {
// $result = $stack->ContentType('ctwithallfields')->Query()->addParam('include_count', 'true')->toJSON()->find();
//$result = $stack->ContentType('ctwithallfields')->Query()->includeCount()->toJSON()->find();
//$result = $stack->ContentType('ctwithallfields')->Query()->addParam('include_dimension', 'true')->toJSON()->find();
// $result = $stack->ContentType('ctwithallfields')->Query()->addParam('include_dimensions', true)->toJSON()->find();
//$result = $stack->ContentType('ctwithallfields')->Entry('blt8d1ab7600ba4c2b4')->addParam('include_dimensions', true)->toJSON()->fetch();
// $result = $stack->Assets()->Query()->addParam('key', 'true')->toJSON()->find();
//$result = $stack->Assets('blt9b5825dd804a9067')->addParam('include_dimension', 'true')->fetch();
// \Contentstack\Utility\debug(($result[0][]));
} catch(Exception $e) {
echo "Message : ".$e->getMessage(); // returns message -> API -> error_message
echo "Code : ".$e->getCode(); // returns number -> API -> error_code
echo "Errors : ".print_r($e->getErrors()); // returns array -> API -> errors
}