本文整理匯總了PHP中tmhOAuth::auto_fix_time_request方法的典型用法代碼示例。如果您正苦於以下問題:PHP tmhOAuth::auto_fix_time_request方法的具體用法?PHP tmhOAuth::auto_fix_time_request怎麽用?PHP tmhOAuth::auto_fix_time_request使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tmhOAuth
的用法示例。
在下文中一共展示了tmhOAuth::auto_fix_time_request方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: tmhOAuth
* This example differs from others in that it will reattempt a request if
* the timestamp is detected to be off from the Twitter servers.
*
* Instructions:
* 1) If you don't have one already, create a Twitter application on
* http://dev.twitter.com/apps
* 2) From the application details page copy the consumer key and consumer
* secret into the place in this code marked with (YOUR_CONSUMER_KEY
* and YOUR_CONSUMER_SECRET)
* 4) Visit the 'My Access Token' screen linked to from your application
* details page
* 5) Copy the user token and user secret into the place in this code marked
* with (A_USER_TOKEN and A_USER_SECRET)
* 6) Visit this page using your web browser.
*
* @author themattharris
*/
require '../tmhOAuth.php';
$tmhOAuth = new tmhOAuth(array('consumer_key' => 'YOUR_CONSUMER_KEY', 'consumer_secret' => 'YOUR_CONSUMER_SECRET', 'user_token' => 'A_USER_TOKEN', 'user_secret' => 'A_USER_SECRET'));
// for the demo set the timestamp to yesterday
$tmhOAuth->config['force_timestamp'] = true;
$tmhOAuth->config['timestamp'] = strtotime('yesterday');
$tmhOAuth->auto_fix_time_request('GET', $tmhOAuth->url('1/account/verify_credentials'));
if ($tmhOAuth->response['code'] == 200) {
if ($tmhOAuth->auto_fixed_time) {
echo 'Had to auto adjust the time. Please check the date and time is correct on your device/server';
}
$tmhOAuth->pr(json_decode($tmhOAuth->response['response']));
} else {
$tmhOAuth->pr(htmlentities($tmhOAuth->response['response']));
}