Hi,
I've got the following code on a php page but when running the page
nothing seems to happen.
My database has a list of statuses with their id and a column named
'Complete' which I want to update to yes once that status has been
retweeted.
Please can someone suggest where I am goign wrong.
The follwoing script does not updaate the record in the Mysql table
nor does it retweet.
I am using Abrahams O auth Library of this.
Thanks,
Ayath
<?php
/**
* @file
*
*/
$con = mysql_connect("host","user","pword");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("dbname") or die(mysql_error());
$result = mysql_query("SELECT * FROM data where complete='no'");
#$num_rows = mysql_num_rows($result);
$row = mysql_fetch_array($result);
/* Load required lib files. */
session_start();
require_once('twitteroauth/twitteroauth.php');
require_once('config.php');
/* SET ACCOUNT VARIBALES */
define("OAUTH_TOKEN", "XYZ");
define("OAUTH_SECRET", "ABC");
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
OAUTH_TOKEN, OAUTH_SECRET);
$i=1;
while($i<= $num_rows)
{
$connection->post('statuses/retweet/$id');
mysql_query("UPDATE data SET complete= 'yes'
WHERE ID = '$id' ");
$i++;
}
?>
--
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group:
https://groups.google.com/forum/#!forum/twitter-development-talk