postaddictme / instagram-php-scraper

Get account information, photos, videos, stories and comments.
https://packagist.org/packages/raiym/instagram-php-scraper
MIT License
3.08k stars 798 forks source link

Error: Using $this when not in object context in InstagramScraper\Instagram::getMediasByTag() (line 414 of InstagramScraper/Instagram.php). #167

Closed ucola closed 6 years ago

ucola commented 6 years ago

Hi all

if I try to use getMediasByTag then I became this error Error: Using $this when not in object context in InstagramScraper\Instagram::getMediasByTag() (line 414 of .../vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php).

if I change the $this to a new object it works, but I don't think that this is a good solution... and if i became the result back, the ownerId is filled out, but not the owner name. Any ideas?

thank for help

search2074 commented 6 years ago

see

ucola commented 6 years ago

ok thank you

we call the methods like this, its this wrong? try { $medias = Instagram::getMediasByTag($tag, $amount); return array('success' => $medias); } catch (\Exception $ex) { return array('error' => $ex); }

search2074 commented 6 years ago

Method has been set not static in version 0.5.0 link.

try this:


try { 
    $instagram = new Instagram();
    $medias = $instagram->getMediasByTag($tag, $amount); 

    return array('success' => $medias); 
} catch (\Exception $ex) { 
    return array('error' => $ex); 
}
ucola commented 6 years ago

work as described