err0r Posted March 1, 2020 Report Share Posted March 1, 2020 Most of the old twitter scripts for mIRC no longer work. Here is a quick guide to create your own. It will require mirc along with PHP First you will need a PHP Wrapper for Twitter API 1.1 calls. You can get that at https://github.com/J7mbo/twitter-api-php You will also need a developer twitter account so you can make the app to use with the api. You can set that up @ https://developer.twitter.com/ The php code i used is <?php require_once('TwitterAPIExchange.php'); /** Set access tokens here - see: https://dev.twitter.com/apps/ **/ $settings = array( 'oauth_access_token' => "", 'oauth_access_token_secret' => "", 'consumer_key' => "", 'consumer_secret' => "" ); // twitter api endpoint $url = 'https://api.twitter.com/1.1/statuses/update.json'; // twitter api endpoint request type $requestMethod = 'POST'; if (isset($_POST['sendtxt'])) { $sendtxt = $_POST['sendtxt']; // twitter api endpoint data $apiData = array( 'status' => $sendtxt, ); // create new twitter for api communication $twitter = new TwitterAPIExchange( $settings ); // make our api call to twiiter $twitter->buildOauth( $url, $requestMethod ); $twitter->setPostfields( $apiData ); $response = $twitter->performRequest( true, array( CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => 0 ) ); // display response from twitter echo '<pre>'; print_r( json_decode( $response, true ) ); } ?> Note you will need to better secure the post info. Also you will need to fill in your keys from your developer account. Then do a simple sock to send the info to the php page on *:text:*!tweet*:#: { tokenize 32 $stripstyle($1-) if ($1 == !tweet && $2) { msg # attempting tweet please wait... set %tweet.msg $2- set %tweet.chan # starttweet } } alias starttweet { sockopen -e tweetsend www.sitename.com 443 } on *:sockopen:tweetsend:{ if ($sockerr) { sockclose $sockname | halt } var %x sendtxt= $+ %tweet.msg sockwrite -n $sockname POST /twitter.php HTTP/1.1 sockwrite -n $sockname Host: $+(www.sitename.com,:,443) sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded sockwrite -n $sockname Content-Length: $len(%x) sockwrite -n $sockname $crlf $+ %x } on *:sockread:tweetsend: { if ($sockerr) { echo -a Error. | halt } var %a | sockread %a if ([created_at] isin %a) { sockclose $sockname | msg %tweet.chan Tweet successful. https://www.twitter.com/twittername } } Once again you will need to edit for your server's domain name and such. Make security changes as needed. Feel free to make and changes or suggest any improvements here. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now