Exemplo n.º 1
0
                                 if ($updatedata['min_interval'] == 0 or $updatedata['max_queued'] <= 1) {
                                     $dm = 'Success! I\'ll now send you an email as soon as I see that you\'ve had a reply. Please see http://twitapps.com/replies for why this may not always be instant.';
                                 } else {
                                     $dm = 'Success! I\'ll now send you an email every ' . $updatedata['min_interval'] / 60 . ' minute' . ($updatedata['min_interval'] == 60 ? '' : 's') . ' or when you\'ve had ' . $updatedata['max_queued'] . ' replies, whichever occurs sooner.';
                                 }
                             } else {
                                 $dm = 'An unhandled error occurred when setting the frequency preference. Try again or contact @twitapps.';
                             }
                         }
                     }
                     break;
                 default:
                     $dm = 'Unknown option "' . $bits[0] . '". Please see http://twitapps.com/replies for valid options.';
                     break;
             }
             Twitter::Tweet('d ' . $headers['x-twittersenderscreenname'] . ' ' . $dm);
             unset($dm);
             break;
         default:
             $pos = strpos($word, '@');
             if ($pos !== false and $pos !== 0) {
                 $email = $word;
                 break 2;
             }
     }
 }
 if ($email !== false) {
     //echo 'Activate for "'.$headers['x-twittersenderscreenname'].'"'."\n";
     if (!User::Activate($headers['x-twittersenderscreenname'], $email)) {
         echo '  Failed to activate user "' . $headers['x-twittersenderscreenname'] . '": ' . mysql_error(GetDB()) . "\n";
     }
Exemplo n.º 2
0
	function __construct() { 
	
		date_default_timezone_set("GMT");
		$this->connection = new TwitterOAuth($this->consumer_key, $this->consumer_secret, $this->access_key, $this->access_secret);
		$content = $this->connection->get("account/rate_limit_status");
		echo '<p style="font:11px Verdana;">Current API hits remaining: <strong>' . $content->remaining_hits . "</strong>";
		$this->user = $this->connection->get("account/verify_credentials");

	}
	
	public function Stats($method, $response, $http_code, $parameters = '') {
	
		echo '<p style="font:11px Verdana;">' . $method. " / <strong>" . $http_code . '</strong></p>';
	
	}

	public function Tweet($tweet) {
	
		$parameters = array("status" => $tweet);
		$status = $this->connection->post("statuses/update", $parameters);
		$this->Stats("statuses/update", $status, $this->connection->http_code, $parameters);
	
	}

}

$Bot = new Twitter();

$Bot->Tweet("http://github.com/abraham/twitteroauth/ + http://github.com/edwardhotchkiss/Twitter-Bot");

?>
Exemplo n.º 3
0
                                         case 'monthly':
                                             $dm = 'Success! I\'ll now send you a monthly update by email on the ' . date('jS', strtotime('2010-01-' . (strlen($updatedata['when']) == 1 ? '0' : ''))) . ' ' . $hour;
                                             break;
                                     }
                                 } else {
                                     $dm = 'An unhandled error occurred when setting the frequency preference. Try again or contact @twitapps.';
                                 }
                             }
                         }
                     }
                     break;
                 default:
                     $dm = 'Unknown option "' . $bits[0] . '". Please see http://twitapps.com/follows for valid options.';
                     break;
             }
             Twitter::Tweet('d ' . $info['headers']['x-twittersenderscreenname'] . ' ' . $dm);
             unset($dm);
             break;
         default:
             $pos = strpos($word, '@');
             if ($pos !== false and $pos !== 0) {
                 $email = $word;
                 break 2;
             }
     }
 }
 if ($email !== false) {
     //echo 'Activate for "'.$info['headers']['x-twittersenderscreenname'].'"'."\n";
     if (!User::Activate($info['headers']['x-twittersenderscreenname'], $email)) {
         echo '  Failed to activate user "' . $info['headers']['x-twittersenderscreenname'] . '": ' . mysql_error(GetDB()) . "\n";
     }
Exemplo n.º 4
0
<?php

require dirname(__FILE__) . '/../fx.php';
while (@ob_end_clean()) {
}
$skipping = true;
$page = 1;
while ($page !== false) {
    $followers = Twitter::GetFollowers('ta_follows', $page);
    foreach ($followers as $f) {
        $exists = User::Exists($f['screen_name']);
        if ($exists or $skipping) {
            continue;
        }
        $skipping = false;
        $user = Twitter::Follow($headers['x-twittersenderscreenname']);
        if (User::Create($f)) {
            echo $f['screen_name'] . " created\n";
            Twitter::Tweet('d ' . $f['screen_name'] . ' Welcome to Follows from TwitApps. Send your email address by direct message to @ta_follows to activate this service.');
        } else {
            echo 'Failed to create user for ' . $f['screen_name'] . ': ' . mysql_error() . "\n";
        }
    }
    if (count($followers) == 100) {
        $page++;
    } else {
        $page = false;
    }
}
Exemplo n.º 5
0
function twitter()
{
    Twitter::Tweet($productUrl);
}
Exemplo n.º 6
0
function twitter()
{
    Twitter::Tweet($input);
}