Ejemplo n.º 1
1
// Set this to true if you want to see all outgoing requests and responses from server
$addback = true;
////////////////////////////////
// Login
$tmpPath = '/tmp/';
$snapchat = new Snapchat($username, $gEmail, $gPasswd, $debug);
$snapchat->login($password);
if ($addback == true) {
    $unconfirmed = $snapchat->getUnconfirmedFriends();
    if (!is_null($unconfirmed)) {
        print_r($unconfirmed);
        foreach ($unconfirmed as $friend) {
            $snapchat->addFriendBack($friend);
        }
    }
}
$snaps = $snapchat->getSnaps();
if (!is_null($snaps)) {
    foreach ($snaps as $snap) {
        echo "Processing SNAP ID [" . $snap->id . "]<br />";
        $snapchat->writeToFile('../src/snaps/' . $snap->id, $snapchat->getMedia($snap->id));
        $tmpFilePath = $tmpPath . $snap->id;
        file_put_contents($tmpFilePath, $snapchat->getMedia($snap->id));
        $snapchat->setStory($tmpFilePath, $snap->time);
        $snapchat->markSnapViewed($snap->id);
        unlink($tmpFilePath);
        $snapchat->sendMessage($snap->sender, "Your snap has been processed, and it should appear on this account's story. Thank you for submitting!");
        echo "Processed!<br /><br />";
    }
}
$snapchat->closeAppEvent();
Ejemplo n.º 2
0
 public function testWrongMedia()
 {
     $snapchat = new Snapchat($this->users[1]['name'], $this->users[1]['pass']);
     $this->assertNotEquals($snapchat->auth_token, FALSE, 'Login failed for test user 1.');
     $data = $snapchat->getMedia('12345');
     $this->assertEquals($data, FALSE);
 }
Ejemplo n.º 3
0
//get feed
$snaps = json_decode(json_encode($snaps), true);
//turn into php array
$i = 0;
foreach ($snaps as $item) {
    if ($item['status'] == 1) {
        //if unopened
        if ($item['sender'] != $config['username']) {
            //if not sent from yourself
            if (!is_banned($item['sender'])) {
                $snapchat->addFriend($item['sender']);
                //add sender as friend if not already
                if ($item['media_type'] == 0) {
                    //if still image
                    if ($config['picturesallowed']) {
                        $data = $snapchat->getMedia($item['id']);
                        //get received snap
                        if ($data != "") {
                            $filename = time() . '__' . $item['sender'] . '.jpg';
                            file_put_contents('media/temp/' . $filename, $data);
                            //create temp file with the received snap
                            if ($config['moderation'] == false) {
                                postImageStory($filename, mod_id(), $config['username'], $config['password']);
                            }
                        }
                    }
                } elseif ($item['media_type'] == 1) {
                    //if moving video
                    if ($config['videosallowed']) {
                        $data = $snapchat->getMedia($item['id']);
                        //get received snap
Ejemplo n.º 4
0
<?php

require_once "../src/snapchat.php";
require_once "../includes/initialize.php";
ini_set('max_execution_time', 300);
$snapchat = new Snapchat();
$snapchat->username = "******";
$snapchat->auth_token = "63cd02e8-fa66-47fe-aa8a-a8506cee98d7";
// $media_key 	= "8dZ3pPQ1pmGapkKpCmigaWfGvNP6xbypLtYs3vE8F4A=";
// $media_iv 	= "euCM4bHAmJ+rQb3qQ2atKQ==";
//$rawdata = file_get_contents("snapphoto.jpg");
// $snapphoto = $snapchat->getMedia("440156392293496400r");
// file_put_contents("snapphoto.jpg", $snapphoto);
$snapvideo = $snapchat->getMedia("544776392143843260r");
var_dump($snapvideo);
file_put_contents("snapvideo.mp4", $snapvideo);
// $snapvideozipped = $snapchat->getMedia("521616392165607400r");
// file_put_contents("snapvideozipped.zip", $snapvideozipped);
// ------------------------------------------------------------------
// $storyphoto = $snapchat->getStory("5205060068835328", "8dZ3pPQ1pmGapkKpCmigaWfGvNP6xbypLtYs3vE8F4A=", "euCM4bHAmJ+rQb3qQ2atKQ==");
// file_put_contents("storyphoto.jpg", $storyphoto);
// $storyvideo = $snapchat->getStory("5915908093509632", "9qVBC5\/1LJxsuFuANq5h27aByu5NyURCTpld68XGzss=", "I3k5OXNyvKqNFdBTeiuRvw==");
// file_put_contents("storyvideo.mp4", $storyvideo);
// $storyvideozipped = $snapchat->getStory("6735908270243840", "vAxqvg1oPn4yAp3/F9+OPA==", "Qai/R6f0/qpoXttZD26BKtGC4LRMis+JOoCgg4w9gNs=");
// file_put_contents("storyvideozipped.zip", $storyvideozipped);
//echo "RAW DATA: ".$rawdata."<br/><br/>";
// file_put_contents("rawstoryphotoencrypted.jpg", $rawdata);
// ------------------------
//$encryptedblobdata = encryptECB($rawdata);
//echo "ENCRYPTED: ".$encryptedblobdata."<br/><br/>";
// ------------------------