Skip to content
Create a gist now

Instantly share code, notes, and snippets.

@ptim /twitget-debug.php secret
Last active Dec 17, 2015

!!! WARNING!! THIS EXPOSES YOUR PRIVATE TWITTER API KEYS AND SECRETS !!! You'll need to regenerate the keys as soon as you make them public: https://dev.twitter.com/apps/
<?php
/*
Debug shortcode for Twitget.
!!! WARNING!! THIS EXPOSES YOUR PRIVATE TWITTER API KEYS AND SECRETS !!!
You'll need to regenerate the keys as soon as you make them public:
https://dev.twitter.com/apps/
To use:
- paste this code into the very bottom of the file twitget.php ( after ?> )
- create a private post
- enter the shortcode [twitget-debug]
*/
if(!class_exists('tmhOAuth')) {
return "Twitget is not active";
}
add_shortcode('twitget-debug', 'twitget_debug_shortcode_handler');
// Debug function
function twitget_debug_shortcode_handler($attributes, $content = null) {
$options = get_option('twitget_settings');
$tmhOAuth = new tmhOAuth(
array(
'consumer_key' => $options['consumer_key'],
'consumer_secret' => $options['consumer_secret'],
'user_token' => $options['user_token'],
'user_secret' => $options['user_secret'],
'curl_ssl_verifypeer' => false
)
);
ob_start();
$code = $tmhOAuth->request('GET', $tmhOAuth->url('1/account/verify_credentials'));
if ($code == 200) {
echo 'The access level of this token is: ' . $tmhOAuth->response['headers']['x_access_level'] . PHP_EOL;
tmhUtilities::pr($tmhOAuth->response);
} else {
tmhUtilities::pr(htmlentities($tmhOAuth->response['response']));
}
echo "\n\n========================================\n\n";
var_dump($tmhOAuth);
$dataDump = ob_get_clean();
return '<pre>'. $dataDump . '</pre>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.