tags:

views:

96

answers:

1

Hey,

This is driving me absolutely crazy. I can update my status using twitterlibphp and I can get followers, following etc but no matter what I do $o->follow(twitter_id) just will not work. It responds with

<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <request>/notifications/follow.xml</request>
  <error>There was a problem following the specified user.</error>
</hash>

I've done some googleling, read through the library source and can't see what on earth I'm doing wrong. If you are in the london area I will probably buy you a pint if you know whats going on... The code is pretty simple:

$twitter = new Twitter($username, $password);
$xml = $twitter->getFriendIDs(array('user'=>$user));
$output = simplexml_load_string($xml);
foreach($output->id as $id) {
   echo $twitter->follow($id);
}

(The $user var just comes from a textbox on a form - all that works fine and the foreach loops over the ID's)

But no dice. Anyone having the same issue or am I doing something silly? I've also tried running $twitter->verifyCredentials() beforehand but still the same unhelpful error. If i put in a random (non-existant) account then it tells me that that user was not found so I know its kinda working.

Cheers!

A: 

Well, I found the following tidbit after some more googling:

follow

Enables notifications for updates from the specified user to the authenticating user. This method requires the authenticated user to already be friends with the specified user otherwise the error "there was a problem following the specified user" will be returned.

Hopefully calling $o->createFriendship($id) and then follow will work :) I'm amazed thats not in the examples or more prominent in the docs...

and FYI for any others that come across this - that worked :)