使用PHP和TwitterOAUTH使用表单发布tweet

使用PHP和TwitterOAUTH使用表单发布tweet,php,forms,twitter,Php,Forms,Twitter,如果有人已经在某个地方回答了这个问题,我诚挚的道歉——我已经搜索了Stack和Google几个小时,但找不到正确的答案。我正在使用Abraham的TwitterOAuth,并成功地显示了我以前的推文。然而,我想制作一个表单,允许我在我的账户上发布新的推文。该表单在刷新页面时似乎会发布,但推文不会发布到我的帐户-非常感谢任何帮助 这是当前设置: (我已经从这篇帖子上取下了钥匙) Sunil推特 <?php //keys $consumer_key = '###'; $consumer_s

如果有人已经在某个地方回答了这个问题,我诚挚的道歉——我已经搜索了Stack和Google几个小时,但找不到正确的答案。我正在使用Abraham的TwitterOAuth,并成功地显示了我以前的推文。然而,我想制作一个表单,允许我在我的账户上发布新的推文。该表单在刷新页面时似乎会发布,但推文不会发布到我的帐户-非常感谢任何帮助

这是当前设置: (我已经从这篇帖子上取下了钥匙)


Sunil推特
<?php

//keys
$consumer_key = '###';
$consumer_secret = '###';
$access_token = '###';
$access_token_secret = '###';

//include library
require "twitteroauth/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;

//connect to API
$connection = new TwitterOAuth($consumer_key, $consumer_secret, $access_token, $access_token_secret);
$content = $connection->get("account/verify_credentials");

// create tweet
$new_status = $connection->post("statuses/update", ["status" => ""]);

//get homepage feed
$statuses = $connection->get("statuses/home_timeline", ["count" => 25, "exclude_replies" => true]);

//get my tweets
$profile = $connection->get("statuses/user_timeline", ["count" => 200, "exclude_replies" => true]);

// display first tweet
// echo($profile[0]->text);
?>

<!DOCTYPE html>

<html>

<head>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,700,800,400italic">
    <link rel="stylesheet" href="custom.css">
</head>

<body>

<div class="jumbotron text-center" style="font-size:48px">Sunil Tweets</div><br>    


    <form method="post" action="index.php">
    <input type="text" id="tweet" name="new tweet"/>
    <input type="submit" value="post tweet"/>
    <input type="hidden" action="<?php echo '$new_status';?>"/>
    </form>


</body>    

</html>