forked from aseba/php-instagram-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcallback.php
More file actions
24 lines (20 loc) · 678 Bytes
/
callback.php
File metadata and controls
24 lines (20 loc) · 678 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
<?php
require_once 'phpirt.php';
class MyProcessor extends SubscriptionProcessor {
const client_secret = 'YOUR API SECRET';
// Redefine this function
public static function process($data){
$file = file_get_contents('/tmp/updates.instagram');
$fulldata = $file . "\n\n" . json_encode($data);
file_put_contents('/tmp/updates.instagram', $fulldata);
}
}
if(isset($_GET['hub_challenge'])) echo $_GET['hub_challenge'];
else{
if(isset($_SERVER['HTTP_X_HUB_SIGNATURE'])){
$igdata = file_get_contents("php://input");
if(hash_hmac('sha1', $igdata, MyProcessor::client_secret) == $_SERVER['HTTP_X_HUB_SIGNATURE'])
MyProcessor::process(json_decode($igdata));
}
}
?>