This just worked for me Martyn:

$object = $connection->post('friendships/create', array('screen_name' =>
'twitter'));

Abraham
-------------
Abraham Williams | Hacker Advocate | http://abrah.am
@abraham | http://projects.abrah.am | http://blog.abrah.am
This email is: [ ] shareable [x] ask first [ ] private.


On Sun, Sep 5, 2010 at 03:44, Martyn <walker...@gmail.com> wrote:

> Can anyone show me how to add a friendship in PHP?  I have tried
> several ways and followed much of the advice on this board without
> luck.
>
> The documentation is vague, it states "Allows the authenticating users
> to follow the user specified in the ID parameter".  Using Abraham
> Williams libraries thats a snap (thanks Abraham!) and I have used it
> for many applications over the last few months.  The new documentation
> leaves a lot to be desired and I can't find any which way to make it
> work:-
>
> http://dev.twitter.com/doc/post/friendships/create
>
> Here's just a few combinations I have tried:-
>
> Take your pick from this block:-
> $params = array('user_id' => $id, 'id' => $id, 'screen_name' =>
> $screen_name);
> $params = array();
> $params = array('user_id' => $id);
> $params = array('id' => $id);
>
>
> And comibine it with this block:-
> $send = simplexml_load_string($twitter->OAuthRequest("http://
> api.twitter.com/1/friendships/create/$screen_name.xml",
> $params,'POST'));
>
> $send = simplexml_load_string($twitter->OAuthRequest("http://
> api.twitter.com/1/friendships/create.xml?id=$id&user_id=
> $id&screen_name=$accountname",$params,'POST'));
>
> send = simplexml_load_string($twitter->OAuthRequest("http://
> api.twitter.com/1/friendships/create/$id.xml",$params,'POST'));
>
> and I have tried them all without any luck.  I have verified
> screen_name and id's are correct.  Checked the API is up and working
> via other calls (such as sending DM's).
>
> I have been able to guess most of the parameters and how to use them
> for read and write operations but this one has left me confused.  I
> would really appreciate a hand.
>
> Kind Regards,
> Martyn
>
> --
> Twitter developer documentation and resources: http://dev.twitter.com/doc
> API updates via Twitter: http://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> http://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> http://groups.google.com/group/twitter-development-talk?hl=en
>

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk?hl=en

Reply via email to