Last active
February 28, 2017 08:36
-
-
Save Daltontastic/e4b5e92a55905e604dc1381e9926d2a4 to your computer and use it in GitHub Desktop.
Download cacert.pem and codebird.php from https://github.com/jublonet/codebird-php/tree/develop/src
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function tweet($tweet) | |
{ | |
define("CONSUMER_KEY", "apps.twitter.com"); | |
define("CONSUMER_SECRET", "apps.twitter.com"); | |
define("ACCESS_TOKEN", "apps.twitter.com"); | |
define("ACCESS_SECRET", "apps.twitter.com"); | |
require_once("codebird.php"); | |
\Codebird\Codebird::setConsumerKey(CONSUMER_KEY, CONSUMER_SECRET); | |
$cb = \Codebird\Codebird::getInstance(); | |
$cb->setToken(ACCESS_TOKEN, ACCESS_SECRET); | |
$params = array( | |
"status" => $tweet | |
); | |
$reply = $cb->statuses_update($params); | |
$data = (array) $reply; | |
if (isset($data["created_at"])) { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
$tweet = tweet("Hi @Daltontastic"); | |
if ($tweet) { | |
echo "Tweeted"; | |
} else { | |
echo "Not Tweeted"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment