2010-09-18 73 views
0

我有以下代碼(從實際腳本獲取):TwitterOAuth對象:類stdClass的的對象無法轉換爲字符串

$result=mysql_query($sql); 
while($row=mysql_fetch_assoc($result)) 
{ 
$auth_token=$row['oauth_token']; 
$auth_token_secret=$row['oauth_token_secret']; 
$apiconn = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $auth_token, $auth_token_secret); 

$API_result = $apiconn->post('friendships/create', array('screen_name' => $uname)); 
echo $API_result . "<br />"; 

} 

我不斷收到錯誤:

Catchable fatal error: Object of class stdClass could not be converted to string in scriptpath on line 26 

線26

$apiconn = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $auth_token, $auth_token_secret); 

我不知道爲什麼會發生這種情況,因爲從that library的例子也一樣出生成錯誤:(。

回答

1

試着做var_dump($API_result)而不是迴應它,看看你如何得到你真正想要的。我認爲這僅僅是關於給第26行的PHP計數行的另一個例子(大概是與不同的操作系統行結束有關,儘管我不知道)。

+0

是的,它錯誤地計算出PHP計數行:( – ariefbayu 2010-09-18 23:27:26

相關問題