Skip to content

Instantly share code, notes, and snippets.

@emr
Created December 8, 2017 20:14
Show Gist options
  • Save emr/93fda13e2ed0fda6def28e7d962fbb8d to your computer and use it in GitHub Desktop.
Save emr/93fda13e2ed0fda6def28e7d962fbb8d to your computer and use it in GitHub Desktop.
instapp kullanimi
<?php
use Instapp\Instapp;
use Instapp\Event\FollowEvent;
use Instapp\Event\LikeEvent;
use Instapp\Event\LogEvent;
/*
* kullanici adi ve sifreyi login metodunda da verebilirsin
*/
$instapp = new Instapp([
'instagram.username' => '...',
'instagram.password' => '...',
]);
/*
* constructor'da kullanici adi sifre
* verdiysen login metoduna tekrar vermene gerek yok
*/
$instapp->login();
/*
* her bir kisi takip edildiginde yapilacaklar
*/
$instapp->on(FollowEvent::NAME, function(FollowEvent $followEvent) {
// kullanici verisi
$followEvent->user;
// takip edildi mi edilmedi mi
// (yalniz bunu hep true donduruyorum daha yapmadim :D)
$followEvent->status;
});
/*
* her bir medya ogesi begenildiginde yapilacaklar
*/
$instapp->on(LikeEvent::NAME, function(LikeEvent $LikeEvent) {
// begenilen medya verisi
$LikeEvent->item;
// durum (true)
$LikeEvent->status;
});
/*
* makrolar calisirken her log basildiginda yapilacaklar
*/
$instapp->on(LogEvent::NAME, function(LogEvent $logEvent) {
// mesaj
$logEvent->message;
// mesaj tipi (normal, info, error)
// hatalari burda yakalayabilirsin
$logEvent->type;
});
/*
* phpstorm kullan event nesnelerinden neler gelecegini kesin bilebilirsin.
* pakette symfony vardumper mevcur dump() fonksiyonu ile de debug yapabilirsin.
*/
/*
* bundan sonra asagida kullanacagin makrolar calisirken yukarda tanimladigin
* eventleri her olay gerceklestiginda calistiracak
*/
// bir kisiyi takip et
$instapp['follow']->followUser(/* kullanici adi veya id */);
// lokasyonda paylasim yapmis tum kullanicilari takip et
$instapp['follow']->followUsersInLocation(/* lokasyon id'si */);
// bir kullanicinin tum takipcilerini takip et
$instapp['follow']->followUserFollowers(/* kullanici adi veya id */);
// :)
$instapp['like']->likeTimeline();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment