JorgenPhi / php-snapchat

A PHP library for the Snapchat API - With Commit History
MIT License
260 stars 73 forks source link

A notice and fatal error when fetching feed #29

Closed martynball closed 8 years ago

martynball commented 10 years ago

I have successfully imported the snapchat.php file using require_once, seems to logged in successfully as it's returning an object.

But when I try and fetch my feed i'm getting the following errors: Notice: Undefined property: Snapchat::$cache in C:\xampp\htdocs\snapchat\src\snapchat.php on line 234

Fatal error: Call to a member function get() on a non-object in C:\xampp\htdocs\snapchat\src\snapchat.php on line 234

hako commented 10 years ago

hmm, It seems to be working fine for me.

I managed to recreate that error after a typo in the password or if the internet connection is off. I'm not sure if it's todo with a blocked IP or something.

Are you using the getUpdates() function?

martynball commented 10 years ago
    //Check login
$snapchat = new Snapchat('martynball', 'password');
//Get snapchat feed
$snaps = $snapchat->getSnaps();
echo $snaps;

There's the code

hako commented 10 years ago

I ran var_dump($snapchat)on your code and the Snapchat object is empty.

class Snapchat#1 (2) { public $auth_token => bool(false) public $username => bool(false) }

Could this be the reason?

I tried it with my credentials and the object wasn't empty.

JorgenPhi commented 10 years ago
<?php

require_once("src/snapchat.php");

// Log in:
$snapchat = new Snapchat('jorgenphi', 'password');

// Get your feed:
$snaps = $snapchat->getSnaps();

var_dump($snaps);
?>

This code works perfectly fine for me (of course using the correct password).

martynball commented 10 years ago

Ah, the code you posted above seems to work perfect, thanks!

JorgenPhi commented 10 years ago

Sweet! I will tell you that $snaps is an array, not a string, so you can't echo it. You can dump the array's contents using var_dump, and can echo a specific element using this:

echo $snaps['key']
benjick commented 9 years ago

Hi

I get the same now. Worked a few hours ago. var_dump($snapchat) gives me

object(Snapchat)#1 (2) {
  ["auth_token"]=>
  bool(false)
  ["username"]=>
  bool(false)
}
pank123 commented 8 years ago

when i use with var_dump its still give me same error

Notice: Undefined property: Snapchat::$cache in D:\Xampp\htdocs\phpsnapchat\src\snapchat.php on line 317

Fatal error: Call to a member function get() on a non-object in D:\Xampp\htdocs\phpsnapchat\src\snapchat.php on line 317

mgp25 commented 8 years ago

@pank123 this code is outdated. Use this one instead: https://github.com/mgp25/SC-API

pank123 commented 8 years ago

Hello thanks for give me this url I have integrate it and first time it was work for me but now its give me Error: UNAUTHORIZED Notice: Trying to get property of non-object in D:\Xampp\htdocs\snapchtapi\src\snapchat.php on line 3079

mgp25 commented 8 years ago

@pank123 you have to create a casper account, please read the wiki here: https://github.com/mgp25/SC-API

pank123 commented 8 years ago

I have create the caster account and set the api key and secret key but still its give me unauthorised error it work for me 2 times but now suddently its stop and give me this error.

pank123 commented 8 years ago

I have create the caster account and set the api key and secret key but still its give me unauthorised error it work for me 2 times but now suddently its stop and give me this error. Please help

mgp25 commented 8 years ago

@pank123 create an issue there: https://github.com/mgp25/SC-API

Not here, and post there the debug log