views:

57

answers:

1

Hi there,

I have the following code (taken from actual script):

$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 />";

}

I keep getting error:

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

line 26 is

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

I don't know why this is happening, because, example from that library does the same without generating error :(.

+1  A: 

Try doing var_dump($API_result) instead of echoing it and see how you get what you actually want. I think this is just another example of PHP counting lines wrongly as regards giving line 26 (presumably something to do with different OS line endings, though I don't know for sure).

46Bit
yes, it turn out PHP count lines wrongly:(
silent