JorgenPhi / php-snapchat

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

Is this script still working? #42

Open jaredco opened 10 years ago

jaredco commented 10 years ago

I've been trying this script but am having trouble with the Login. I am passing my username and password (I verified they are working on the device) but the login keeps failing.

This is my PHP test page :

<?php

include ("snapchat.php") ; echo "TEST" ;

// Log in: $snapchat = new Snapchat('myjefxxxxx', 'ccccccx');

echo "1" ;

// Get your feed: $snaps = $snapchat->getSnaps(); echo "2" ; ?>

Any help would be appreciated. Thanks.

jaredco commented 10 years ago

Thanks for responding. I added an echo "fail" in Login in "snapchat.php" and it does display.   If it should work I will do more debugging to see why it fails.Thx, Steve Sent from my BlackBerry Z30 From: OlaRingdalenSent: Thursday, August 7, 2014 5:42 PMTo: JorgenPhi/php-snapchatReply To: JorgenPhi/php-snapchatCc: Steven KaderSubject: Re: [php-snapchat] Is this script still working? (#42)Do you have the right path to "snapchat.php"?

—Reply to this email directly or view it on GitHub.

jaredco commented 10 years ago

I dug deeper and see that the result being returned is this : "{"message":"The network you are connected to has been temporarily blocked because of suspicious activity","status":403,"logged":false}

Snapchat seems to have blocked the IP and not sure if this will go away and/or be recurring.

Anyone else seen this. Thanks for the help.

jghazally commented 10 years ago

Same issue, tried on a new EC2 Instance, :(

HSPDev commented 10 years ago

I'm pretty sure the block is temporary. It could be that someone else has been spamming from the Amazon network.

I wrote a bot last night, and had it run every minute. That was SO stupid! Now the free server I used is blocked.

BUT I think I have a fix, that seems to be working. Intercept the login call, where the auth token is stored, and save the auth token for maybe 12 hours at a time, or just until it starts failing. That seems to fix the issue. Also add random delays between fetching stuff from their server. E.g. I'm waiting between 20 and 45 seconds to receive updates from them in each iteration now. That works great!

I might submit a fix to the git repository, for the class itself.

jaredco commented 10 years ago

Great. If it is still working could you post the code changes. Not sure what to change to duplicate what you said. Thanks.

HSPDev commented 10 years ago

I'm already on it. I've made a patched version and updated the readme with an example on how to do this at https://github.com/HSPSoftware/php-snapchat

Please note that you might still get blocked if you hammer them with thousands of requests, but this should at least help you not get blocked as easily, as it won't log you in over and over again. I don't know when the auth key will expire, but as soon as it does (isLoggedIn returns false afterwards) I would attempt to log in again with the normal password. But as far as I can tell, it has no expiration. (They might make it trickier now that I've updated the library to avoid their bot detection, as I think they relied heavily upon detecting the constant logins).

Will send a merge request to get the new code and examples into the main repository.

jaredco commented 10 years ago

Great...thanks for the help.

On Sat, Sep 6, 2014 at 11:51 AM, Henrik Pedersen notifications@github.com wrote:

I'm already on it. I've made a patched version and updated the readme with an example on how to do this at https://github.com/HSPSoftware/php-snapchat

Please note that you might still get blocked if you hammer them with thousands of requests, but this should at least help you not get blocked as easily, as it won't log you in over and over again. I don't know when the auth key will expire, but as soon as it does (isLoggedIn returns false afterwards) I would attempt to log in again with the normal password. But as far as I can tell, it has no expiration. (They might make it trickier now that I've updated the library to avoid their bot detection, as I think they relied heavily upon detecting the constant logins).

Will send a merge request to get the new code and examples into the main repository.

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


Steven Kader | CEO | The Jared Company http://jaredcompany.com

Follow me on Twitter : http://twitter.com/StevenKader

Email: steve@jaredcompany.com

Chris-Pr commented 10 years ago

print_r($array);