▒█▀▀█ █▀▀ █░░█ ▒█▀▀█ █░░█ ░▀░ █▀▀█
▒█▄▄█ ▀▀█ █▄▄█ ▒█░░░ █▀▀█ ▀█▀ █░░█
▒█░░░ ▀▀▀ ▄▄▄█ ▒█▄▄█ ▀░░▀ ▀▀▀ █▀▀▀
No description available<?php include_once 'class.spider.php'; /* * Twitter Bot class * Coded by Armagan Corlu aka Psy_chip * root@psychip.net * 2012 * * Developed for 11.06.2012 twitter mobile site * requires curl, psylib, psyspider, simplehtmldom * * spesifications: * -- can post tweet like real human (no app info on tweet detail) * -- can get timeline with unlimited page depth * -- follow, unfollow user * -- login, logout * -- Retweet (new) * -- get mentions * -- automatically login on create * * sample usage: $bot = new twitter_bot_mobile('username', 'password'); var_dump($hede->follow('psy_Chip')); * * */ class twitter_bot_mobile { private $domain = "https://mobile.twitter.com"; private $logingate = "/session/new"; private $logout = '/session/destroy'; private $tweetpage = "/compose/tweet"; private $mentions = '/mentions'; private $user = ""; private $pass = ""; private $ch = null; private $buffer = ""; private $authtoken = ""; private $lastpage = ""; private $notauthstring = 'Sign in'; // bu stringi bulamassa oturum acilmis say function __destruct() { curl_close($this->ch); } public function __construct($usr, $pass) { if (!function_exists("curl_init")) die("TwitterBOT needs curl php module!"); if (!function_exists("psycore_init")) die("TwitterBOT needs psylib framework!"); $this->user = $usr; $this->pass = $pass; $this->ch = curl_init(); curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($this->ch, CURLOPT_FAILONERROR, 1); curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($this->ch, CURLOPT_TIMEOUT, 10); curl_setopt($this->ch, CURLOPT_COOKIEJAR, root . "psybot_cookie_" . md5($usr . $pass) . ".dat"); curl_setopt($this->ch, CURLOPT_COOKIEFILE, root . "psybot_cookie_" . md5($usr . $pass) . ".dat"); curl_setopt($this->ch, CURLOPT_USERAGENT, "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3 "); if ($this->authstatus() == false) { $this->login(); } } private function verifyhtml() { $hede = stristr($this->buffer, '<html'); if (strlen($hede) > 0) { return true; } else { echo '<br>'; echo nl; die('<b>Error! received data not valid</b>'); } } private function getpage($page) { curl_setopt($this->ch, CURLOPT_URL, $page); $this->buffer = curl_exec($this->ch); $this->verifyhtml(); return $this->buffer; } private function postdata($url, $data) { // curl_setopt($this->ch, CURLOPT_REFERER, $this->lastpage); curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data); curl_setopt($this->ch, CURLOPT_URL, $url); $this->buffer = curl_exec($this->ch); $this->verifyhtml(); return $this->buffer; // $this->lastpage = $url; } private function authstatus() { $this->getpage($this->domain); $hede = stristr($this->buffer, $this->notauthstring); if (strlen($hede) > 0) { return false; } else { return true; } } private function findtoken() { $this->verifyhtml(); $logoutform = spider_extractdom($this->buffer, 'div#footer'); $form = spider_formparcala($logoutform); $this->authtoken = $form['authenticity_token']; } ///// public function follow($user) { $this->getpage($this->domain . '/' . $user); $this->findtoken(); $strpost = "authenticity_token=" . urlencode($this->authtoken); $this->postdata($this->domain . '/' . $user . '/follow', $strpost); return $this->buffer; } public function unfollow($user) { $this->getpage($this->domain . '/' . $user); $this->findtoken(); $strpost = "authenticity_token=" . urlencode($this->authtoken); $strpost .="&_method=delete"; $strpost .="&return_url=" . urlencode('/' . $user); $this->postdata($this->domain . '/' . $user . '/unfollow', $strpost); return $this->buffer; } public function logout() { if ($this->authstatus() == true) { $this->getpage($this->domain); $this->findtoken(); $strpost = "authenticity_token=" . urlencode($this->authtoken); $this->postdata($this->domain . $this->logout, $strpost); if ($this->authstatus() == false) { return 'logged out'; } } else { return 'not logged in'; } } public function login() { curl_setopt($this->ch, CURLOPT_URL, $this->domain . $this->logingate); $page = curl_exec($this->ch); $elem = spider_extractdom($page, 'div.body'); $form = spider_formparcala($elem); $strpost = "authenticity_token=" . urlencode($form['authenticity_token']) . "&username=" . urlencode($this->user) . "&password=" . urlencode($this->pass); $this->postdata($form['form_action'], $strpost); return $this->buffer; } public function retweet($tweetid) { $this->getpage($this->domain); $this->findtoken(); $strpost = "authenticity_token=" . urlencode($this->authtoken); $strpost .='&tweet_id=' . $tweetid; $strpost .='&method=POST'; $strpost .='&return_url=/#tweet_' . $tweetid; $this->postdata($this->domain . '/statuses/' . $tweetid . '/retweet', $strpost); return $this->buffer; } private function timeline_parseline($line) { $cikti = array(); $twid = spider_extractdom($line, '.metadata'); $twid = spider_getlinks($twid); $twid = basename($twid[0]); $cikti['user'] = xtrim(strip_tags(spider_extractdom($line, '.username'))); $cikti['fullname'] = strip_tags(spider_extractdom($line, '.fullname')); $cikti['tweet'] = strip_tags(html_entity_decode(spider_extractdom($line, '.tweet-text'))); $cikti['tweet_id'] = $twid; return $cikti; } private function parse_timeline() { $timeline = spider_parsedom($this->buffer, '#main_content', 'table', "", false); $cikti = array(); foreach ($timeline as $line) { $tmparr = $this->timeline_parseline($line); $cikti[] = $tmparr; } return $cikti; } public function getmentions() { $this->getpage($this->domain . $this->mentions); $timeline = spider_parsedom($this->buffer, '#main_content', 'table', "", false); $cikti = array(); foreach ($timeline as $line) { $tmparr = $this->timeline_parseline($line); $cikti[] = $tmparr; } return $cikti; } public function latest_timeline() { $this->getpage($this->domain); return $this->parse_timeline(); } public function timeline_inception($page_deph = 3) { $cikti = array(); $this->getpage($this->domain); for ($x = 0; $x < $page_deph; $x++) { $link = spider_extractdom($this->buffer, '.w-button-more'); $links = spider_getlinks($link); curl_setopt($this->ch, CURLOPT_URL, $this->domain . $links[0]); $this->buffer = curl_exec($this->ch); $cikti = array_merge($cikti, $this->parse_timeline()); } return $cikti; } public function newtweet($status) { $this->getpage($this->domain . $this->tweetpage); $elem = spider_extractdom($this->buffer, 'div.tweetbox-container'); $form = spider_formparcala($elem); $ar = array("authenticity_token" => $form['authenticity_token'], "tweet[text]" => $status, "tweet[display_coordinates]" => false, "commit" => "Tweet"); $data = http_build_query($ar); $this->postdata($this->domain, $data); return $this->buffer; } } ?>
libraspi.js
3 Year, 1 Month ago
wifi_sensor_station.ino
serialrelay.ino
sensorstation.ino
class.dbipc.php