Insecure secure key\nChange $secureKey in ' . $_SERVER['PHP_SELF'] . "\n");
}
if($consumerKey == "consumerKey") // DO NOT CHANGE THIS LINE
{
die('
$consumerKey not changed
\nChange $consumerKey in ' . $_SERVER['PHP_SELF'] . "\n");
}
if($consumerSecret == "consumerSecret") // DO NOT CHANGE THIS LINE
{
die('$consumerSecret not changed
\nChange $consumerSecret in ' . $_SERVER['PHP_SELF'] . "\n");
}
if($accessToken == "accessToken") // DO NOT CHANGE THIS LINE
{
die('$accessToken not changed
\nChange $accessToken in ' . $_SERVER['PHP_SELF'] . "\n");
}
if($accessTokenSecret == "accessTokenSecret") // DO NOT CHANGE THIS LINE
{
die('$accessTokenSecret not changed
\nChange $accessTokenSecret in ' . $_SERVER['PHP_SELF'] . "\n");
}
function tweet($message)
{
// add the codebird library
require_once($codebirdLibraryFile);
// note: consumerKey, consumerSecret, accessToken, and accessTokenSecret all come from your twitter app at https://apps.twitter.com/
\Codebird\Codebird::setConsumerKey($consumerKey, $consumerSecret);
$cb = \Codebird\Codebird::getInstance();
$cb->setToken($accessToken", $accessTokenSecret);
$params = array(
'status' => $message
);
$reply = $cb->statuses_update($params);
echo "";
print_r($reply);
echo "
";
}
//example call
//tweet("Autopost to #Twitter with a #PHP API, check it out here: http://bit.ly/163eHsL");
$key = false;
$message = false;
if(isset($_GET))
{
$key = isset($_GET[$keyParamName]) ? $_GET[$keyParamName] : false;
}
if(isset($_POST) && $key === false)
{
$key = isset($_POST[$keyParamName]) ? $_POST[$keyParamName] : false;
}
if($key === false)
{
die("key not present
\nThe script could not confirm your identity\n");
}
else
{
if($key == $secureKey)
{
if(isset($_GET))
{
if(isset($_GET[$messageParamName]))
{
$message = $_GET[$messageParamName];
}
}
if(isset($_POST) && $message === false)
{
if(isset($_POST[$messageParamName]))
{
$message = $_POST[$messageParamName];
}
}
if($message === false)
die("No message
\nno message found\n");
if(strlen(message) == 0)
{
die("No message
message passed is too short\n");
}
if(strlen($message) <= 140)
{
tweet($message);
}
else
{
die("Message too long
message passed is too long - maximum 140 characters [" . strlen($message) . "]\n");
}
}
else
{
die("invalid key
\nThe script could not confirm your identity\n");
}
}
?>