[twitter-dev] Understanding /friendships/create and how to create a friendship

2010-09-05 Thread Martyn
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=$iduser_id=
$idscreen_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-dev] Stumped by Failed to validate oauth signature or token

2009-05-02 Thread Martyn

I have seen several posts but I don't understand the answers :( I'm
fairly new to all this so I apologize if I'm missing something
obvious.

Using twitterOAuth from https://docs.google.com/View?docID=dcf2dzzs_2339fzbfsf4
I manage to grab and save the access tokens oauth_token as $user_token
and oauth_token_secret as $user_secret and can use them to
successfully call verify_credentials.xml

However if I try make a second call it doesn't work, for example:-

$msg = 'test';
$twitter =  new TwitterOAuth($consumer_key, $consumer_secret,
$user_token, $user_secret);
$xml_string = $twitter-OAuthRequest('https://twitter.com/statuses/
update.xml', array('status' = $msg), 'POST');

Returns Failed to validate oauth signature or token.

Any ideas what I can do to make this work?

Thanks,
Martyn


[twitter-dev] Re: Stumped by Failed to validate oauth signature or token

2009-05-02 Thread Martyn

Ouch! I have been stupid after all.  My session was open on the
domain, while my test page was on the www sub domain.

I will go away, hang my head in shame, and be quiet now!

Thanks for your help.
Martyn


On May 3, 12:46 am, Abraham Williams 4bra...@gmail.com wrote:
 Is it possible that one or more of the tokens are getting overwritten or
 lost in the process?



 On Sat, May 2, 2009 at 18:13, Martyn walker...@gmail.com wrote:

  I have seen several posts but I don't understand the answers :( I'm
  fairly new to all this so I apologize if I'm missing something
  obvious.

  Using twitterOAuth from
 https://docs.google.com/View?docID=dcf2dzzs_2339fzbfsf4
  I manage to grab and save the access tokens oauth_token as $user_token
  and oauth_token_secret as $user_secret and can use them to
  successfully call verify_credentials.xml

  However if I try make a second call it doesn't work, for example:-

  $msg = 'test';
  $twitter =  new TwitterOAuth($consumer_key, $consumer_secret,
  $user_token, $user_secret);
  $xml_string = $twitter-OAuthRequest('https://twitter.com/statuses/
  update.xml https://twitter.com/statuses/%0Aupdate.xml', array('status'
  = $msg), 'POST');

  Returns Failed to validate oauth signature or token.

  Any ideas what I can do to make this work?

  Thanks,
  Martyn

 --
 Abraham Williams |http://the.hackerconundrum.com
 Hacker |http://abrah.am|http://twitter.com/abraham
 Web608 | Community Evangelist |http://web608.org
 This email is: [ ] blogable [x] ask first [ ] private.
 Sent from Milwaukee, WI, United States


[twitter-dev] Re: Stumped by Failed to validate oauth signature or token

2009-05-02 Thread Martyn

They are being passed in $_SESSION variables. I have debug code
printing to screen and they look the same but I'll go check, judging
by your answer I may well have done something stoopid after all!

Thanks,
Martyn




On May 3, 12:46 am, Abraham Williams 4bra...@gmail.com wrote:
 Is it possible that one or more of the tokens are getting overwritten or
 lost in the process?



 On Sat, May 2, 2009 at 18:13, Martyn walker...@gmail.com wrote:

  I have seen several posts but I don't understand the answers :( I'm
  fairly new to all this so I apologize if I'm missing something
  obvious.

  Using twitterOAuth from
 https://docs.google.com/View?docID=dcf2dzzs_2339fzbfsf4
  I manage to grab and save the access tokens oauth_token as $user_token
  and oauth_token_secret as $user_secret and can use them to
  successfully call verify_credentials.xml

  However if I try make a second call it doesn't work, for example:-

  $msg = 'test';
  $twitter =  new TwitterOAuth($consumer_key, $consumer_secret,
  $user_token, $user_secret);
  $xml_string = $twitter-OAuthRequest('https://twitter.com/statuses/
  update.xml https://twitter.com/statuses/%0Aupdate.xml', array('status'
  = $msg), 'POST');

  Returns Failed to validate oauth signature or token.

  Any ideas what I can do to make this work?

  Thanks,
  Martyn

 --
 Abraham Williams |http://the.hackerconundrum.com
 Hacker |http://abrah.am|http://twitter.com/abraham
 Web608 | Community Evangelist |http://web608.org
 This email is: [ ] blogable [x] ask first [ ] private.
 Sent from Milwaukee, WI, United States