Mercurial > nebulaweb3
comparison default/assets/vendors/theme-widgets/getFacebookFeed.php @ 0:1d038bc9b3d2 default tip
Up:default
author | Liny <dev@neowd.com> |
---|---|
date | Sat, 31 May 2025 09:21:51 +0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1d038bc9b3d2 |
---|---|
1 <?php | |
2 require "vendor/autoload.php"; | |
3 | |
4 define("APP_ID", "629815533892815"); | |
5 define("APP_SECRET", "f26c315139206cbc69545d6a3b374e05"); | |
6 define("APP_NAMESPACE", "unifato_feed"); | |
7 | |
8 use \Mute\Facebook\App; | |
9 | |
10 $defaults = [ | |
11 'user' => 'envato', | |
12 'limit' => 3, | |
13 ]; | |
14 | |
15 header('Content-type: text/json'); | |
16 try { | |
17 $options = $_GET; | |
18 $options = array_merge( $defaults, $options); | |
19 | |
20 $customApp = new App(APP_ID, APP_SECRET, APP_NAMESPACE); | |
21 $response = $customApp->batch(function($app) use ( $options ) { | |
22 $app->get( $options['user'] . '/feed', $options); | |
23 $app->get( $options['user'] , array('fields'=>'name,username,picture')); | |
24 }); | |
25 echo json_encode( $response ); | |
26 } catch( Exception $e ){ | |
27 $err = array( | |
28 'error' => 1, | |
29 'file' => $e->getFile(), | |
30 'line' => $e->getLine(), | |
31 'message' => $e->getMessage(), | |
32 ); | |
33 echo json_encode( $err ); | |
34 } |