在非对象上调用成员函数post()

时间:2013-12-20 03:08:10

标签: php twitter twitter-oauth

我有从数据库获取密钥和秘密列表的代码,结构被描述为here。无论如何,当我尝试提交表单并使用列表获取收藏夹时,它会给我上面列出的错误(在非对象上调用成员函数post())并且我不确定为什么。无论如何这是我的代码,看到任何错误?

<?php
if(isset($_POST['submit'])){
require_once('twitteroauth/twitteroauth.php');
$amt = rand(10,18);
$sub = rand(1,2);
$amt1 = $amt-$sub-1;
$con=mysqli_connect("crowngaming.ipagemysql.com","twitter","Hipporules2?","twtid");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con,"SELECT * FROM twitter");
$connection = array();
while ($row = mysqli_fetch_array($result)) {
    $iden = $row['id'];
    $connection[$iden] = new TwitterOAuth('ZG808c0pad0ar7wpgYPmA', 'BWHnOag1aWQtoYRBH5OtsI9m9Ghr3pTuMBo6z4ZNNP8', $row['key'], $row['secret']);
}   
/* Create a TwitterOauth object with consumer/user tokens. */
/* $content = $access_token['oauth_token']. " " . $access_token['oauth_token_secret']; */
/* $content = $connection->get("account/verify_credentials"); */

$url1 = parse_url($_POST['url'], PHP_URL_PATH);
$url = explode("/", $url1);

/* If method is set change API call made. Test is called by default. */
$method = 'statuses/retweet/'.$url[3];

for ($x=0; $x<=$amt; $x++)
   {
if($_POST['retweet'] == "Retweet"){
$content = twitteroauth_row($method, $connection[$x]->post($method), $connection[$x]->http_code);
}
if($x == 9) {
$done = "yes";
}
}

for ($y=0; $y<=$amt1; $y++)
   {
if($_POST['favorite'] == "Favourite"){
$content = $connection[$y]->post('favorites/create', array('id' => $url[3]));   
}

   }
}

0 个答案:

没有答案