public
Last active

!!! 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/

  • Download Gist
twitget-debug.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
<?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>';
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.