<?php
require 'twitteroauth/tmhOAuth.php';
require 'twitteroauth/tmhUtilities.php';
$tmhOAuth = new tmhOAuth(array(
'consumer_key' => 'CORRECT_KEY',
'consumer_secret' => 'zCORRECT_KEY',
'user_token' => '1CORRECT_KEY',
'user_secret' => 'CORRECT_KEY',
));
$code = $tmhOAuth->request('GET', $tmhOAuth->url('1.1/statuses/user_timeline'), array(
'screen_name' => 'MYSCREENNAME'));
$response = $tmhOAuth->response['response'];
print_r($response);
$data = json_decode($response);
foreach($data as $item){
echo $item->text.'<br>';
}
此代码在我的locahost上运行得非常好。但我不能理解,为什么它不适用于我的测试网络托管服务器(freehostia - 免费网络托管计划)。即使在print_r堆栈中我也没有得到任何输出。服务器上的输出如下: