Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- set_time_limit(0);
- date_default_timezone_set('UTC');
- require_once ('../vendor/autoload.php');
- /////// CONFIG ///////
- $username = 'kranky.karl';
- $password = 'zmpq1234';
- $debug = true;
- $truncatedDebug = false;
- //////////////////////
- $ig = new \InstagramAPI\Instagram($debug, $truncatedDebug);
- try {
- $ig->login($username, $password);
- } catch (\Exception $e) {
- echo 'Something went wrong: '.$e->getMessage()."\n";
- exit(0);
- }
- $loop = \React\EventLoop\Factory::create();
- $push = new \InstagramAPI\Push($loop, $ig, $logger);
- $push->on('incoming', function (\InstagramAPI\Push\Notification $push) {
- printf('%s%s', $push->getMessage(), PHP_EOL);
- });
- $push->on('direct_v2_message', function (\InstagramAPI\Push\Notification $push) {
- printf(
- 'Thread ID: %s. Thread item ID: %s.%s',
- $push->getActionParam('id'),
- $push->getActionParam('x'),
- PHP_EOL
- );
- });
- $push->on('error', function (\Exception $e) use ($push, $loop) {
- printf('[!!!] Got fatal error from FBNS: %s%s', $e->getMessage(), PHP_EOL);
- $push->stop();
- $loop->stop();
- });
- $push->start();
- $loop->run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement