php-snapchat icon indicating copy to clipboard operation
php-snapchat copied to clipboard

Can't get this to work.

Open shiznewski opened this issue 9 years ago • 23 comments

i'm trying to login, add friend and send snap image (jpg).

I will pay someone $25 to help me do this. I have spend many hours and i can't get it to work

shiznewski avatar Dec 04 '14 19:12 shiznewski

Here's an example:

$s = new Snapchat("YOUR_USERNAME", "YOUR_PASSWORD");

$snaps = $s->addFriend('FRIEND');

$snap = $s->upload(
    Snapchat::MEDIA_IMAGE,
    file_get_contents('IMAGE.jpg')
);

$s->send($snap, array('FRIEND'), 5);

Did you look at the usage section? https://github.com/JorgenPhi/php-snapchat#usage

If so, I need more detail of the problem please.

hako avatar Dec 04 '14 19:12 hako

Yes i looked at the usage section. I copied all the files i snapchat.php, snapchat_agent.php, snapchat_cache.php ca_bundle.crt

i made a new file with your code above. and it doesn't login. require_once('src/snapchat.php'); $s = new Snapchat("shiznewskii", "mypass");

//$snaps = $s->addFriend('FRIEND');

$snap = $s->upload( Snapchat::MEDIA_IMAGE, file_get_contents('clown.jpg') );

$s->send($snap, array('friendsname'), 5);

I'm not sure if i have the wrong login server or what

shiznewski avatar Dec 04 '14 20:12 shiznewski

What errors do you get when you run the code?

hako avatar Dec 04 '14 20:12 hako

none. if i put an echo in the login function to output if it makes it to the failed if, i always see it. so i'm not sure what the problem is.

is the page im using to test the code i posted above. I can zip up the folder if you would like

shiznewski avatar Dec 04 '14 20:12 shiznewski

Compress it and i'll see what the problem is.

hako avatar Dec 04 '14 20:12 hako

You missed out <?php at the start of the file.

hako avatar Dec 04 '14 21:12 hako

i just doubled checked every file to make sure they have in them. It still doesn't work. i added a line "echo 'i didnt log in';" in the login failed part of the function. it always fails on the login.

shiznewski avatar Dec 04 '14 22:12 shiznewski

It seems it's working for me on my end, It might be your server.

Could you run var_dump() on the $s variable? eg. var_dump($s);

hako avatar Dec 04 '14 23:12 hako

Here is the output. Its the same on my cheap hostgator hosting, and on my vps at digitalocean. object(Snapchat)#1 (2) { ["auth_token"]=> bool(false) ["username"]=> bool(false) }

shiznewski avatar Dec 04 '14 23:12 shiznewski

I cannot log in. my client is telling me it's incorrect. Is it SFTP or FTP?

Also, I tested the code on Heroku and it works fine except with your login. Try make a new user on Snapchat.

hako avatar Dec 05 '14 00:12 hako

Sorry i'm an idiot. the username is admin_helper3

I just tried it with my real snapchat user and pass still doesn't work. Its been driving me nuts all day. I tried user:pass and email:pass. doesn't seem to want to work. It seemed like it worked for you with my credentials ones because i got an email about it. It looks like someone logged into your account from a device named "Android" on 12/04/2014 at 23:10:31 UTC. The login took place somewhere near Lincoln, ENG, GB (IP = 212.219.220.117).

shiznewski avatar Dec 05 '14 00:12 shiznewski

That was me testing it. Did Snapchat send that to you?

hako avatar Dec 05 '14 00:12 hako

yea snapchat sent that to me. So it looks like it logged in for you once atleast. it didn' t do that for me ever today.

shiznewski avatar Dec 05 '14 00:12 shiznewski

i just received a snap from the account in the source with the clown picture.

shiznewski avatar Dec 05 '14 01:12 shiznewski

Yeah, It also looks like that Snapchat is trying to block your server. I used Runscope to get around it, but it's still trying to block your requests.

That's why you cannot log in.

{
  "message": "The network you are connected to has been temporarily blocked because of suspicious  activity",
  "status": 403,
  "logged": false
}

For a workaround see #42 and https://github.com/HSPSoftware/php-snapchat

hako avatar Dec 05 '14 01:12 hako

Thank you for the help.i moved it to a new ip and it works. Plus the new thread you linked me to helps with savin the auth.

shiznewski avatar Dec 05 '14 17:12 shiznewski

I'm having a similar issue on my Digital Ocean server. If I create the object with an existing access token, all the subsequent requests work perfectly, but if I try to log in with a username and password I get this.

object(Snapchat)[169]
  public 'auth_token' => boolean false
  public 'username' => boolean false

In my local machine everything works. At first I thought my server might be getting rejected for some reason (even though it's been this way from the start so it can't be the number of requests), but after trying with a new IP (and failing) and finding out the requests work with an existing token, I'm left wondering if there's some server-related issue on the login method.

fefogarcia avatar Dec 10 '14 22:12 fefogarcia

Help ! I can't login too.

object(Snapchat)#1 (2) {
  ["auth_token"]=>
  bool(false)
  ["username"]=>
  bool(false)
}

jvkassi avatar Dec 25 '14 18:12 jvkassi

I used to not be able to log in only from my server and found out it was blocked.

Since yesterday, however, I haven’t been able to log in from any of my scripts - not even from my local computer. I think this API, maybe the endpoints it's using, has been compromised.

Felipe Edoardo Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Thursday, December 25, 2014 at 1:22 PM, mib4fun wrote:

Help ! I can't login too.
object(Snapchat)#1 (2) { ["auth_token"]=> bool(false) ["username"]=> bool(false) }

— Reply to this email directly or view it on GitHub (https://github.com/JorgenPhi/php-snapchat/issues/56#issuecomment-68109915).

fefogarcia avatar Dec 25 '14 19:12 fefogarcia

@mib4fun @fegd this is most likely to do with Snapchat's headers. Could you try changing your headers? see #64

hako avatar Dec 26 '14 12:12 hako

Didn't work for me, unfortunately, and some friends haven't been able to use their iOS third-party Snapchat apps either

fefogarcia avatar Dec 26 '14 17:12 fefogarcia

Can you provide some sample code so I can investigate further?

hako avatar Dec 26 '14 18:12 hako

I use exactly the code that is here - operations using an existing auth_token work, but I can't login with a username and password, it just returns false.

I'm going to put some var_dumps into the login and post methods to see if I can see the actual response from the server.

fefogarcia avatar Dec 27 '14 05:12 fefogarcia