Esempio n. 1
0
			<span class="ret" id="' . $row['id'] . '">
			<span>' . $row['retweeted'] . '</span><span><img src="images/re.png" alt=""></span></span>
			<span class="com" id="' . $row['id'] . '" ">
			<span>&nbsp;</span><span><img src="images/co.png" alt=""></span></span>
			<div class="comment commentid' . $row['id'] . '"></div>
			<div class="comment comment' . $row['id'] . '" style="display:none;">
			<form id="form">
			<textarea name="comment" maxlength="160">@' . $row['screen_name'] . ' </textarea>
			<a class="sub" id="' . $row['id'] . '">Tweet</a>
			</form>
			</div>
			</div>
			</div>';
        }
    }
    $html .= '</div>';
} else {
    $getToken = $tweets->sendRequest('POST', 'https://api.twitter.com/oauth/request_token', array('oauth_callback' => 'http://www.zawity.com/twitter/index.php'), null);
    parse_str($getToken, $getfields);
    $_SESSION['oauth_token'] = $getfields['oauth_token'];
    $_SESSION['oauth_token_secret'] = $getfields['oauth_token_secret'];
    $html .= '<div id="per">
<h1>Welcome to My twitter APP </h1>
<span>Please give this App an authorization to read & write on your profile</span>
<a href="https://api.twitter.com/oauth/authorize?oauth_token=' . $getfields['oauth_token'] . '">Authorize App on Twitter</a>
</div>';
}
$html .= '
</body>
</html>';
echo $html;
Esempio n. 2
0
<?php

session_start();
require_once "TwitterAPI.php";
include_once "settings.php";
$Tweets = new TwitterAPI($settings);
if (!empty($_GET)) {
    //add comment
    if (!empty($_GET['id']) && is_numeric($_GET['id']) && !empty($_GET['comment'])) {
        $id = $_GET['id'];
        $comment = htmlentities(addslashes($_GET['comment']));
        $postfields = array('status' => $comment, 'in_reply_to_status_id' => $id);
        $addComment = $Tweets->sendRequest('POST', 'https://api.twitter.com/1.1/statuses/update.json', $postfields, null);
        if (!empty($addComment)) {
            echo "<div class='ok'>Your comment added successfully</div>";
        } else {
            echo "<div class='error'>Something wrong happened!<div>";
        }
    }
    //favorit
    if (!empty($_GET['id']) && is_numeric($_GET['id']) && $_GET['action'] == 'ret') {
        $id = $_GET['id'];
        $postfields = array('id' => $id);
        $addRet = $Tweets->sendRequest('POST', 'https://api.twitter.com/1.1/statuses/retweet/' . $id . '.json', $postfields, null);
        if (!empty($addRet)) {
            $update = $Tweets->updateTweets($id, "retweeted");
            echo "<div class='ok'>You have retweeted this tweet</div>";
        } else {
            echo "<div class='error'>Something wrong happened!</div>";
        }
    }