[twitter-dev] Re: Current TwitterOAuth API won't display authorization page

2010-07-08 Thread Indo Optimis
Hi, I'm new in twitter development.

I have a problem when I'm using twitter connect (Sign in with twitter)
with OAuth.
I can Sign In successfully, but I can't fetch the data of the user.
I've tried it in ordinary php script, and it was success.
It's appear like this :

---
stdClass Object
(
[contributors_enabled] =>
[friends_count] => 29
[description] =>
[location] => ÜT: -7.759407,110.388536
[geo_enabled] =>
[profile_background_color] => 9ae4e8
[profile_image_url] => 
http://a3.twimg.com/profile_images/774134793/IMG_4749_-_Copy_normal.JPG
[status] => stdClass Object
(
[favorited] =>
[in_reply_to_user_id] =>
[source] => UberTwitter
[created_at] => Mon Jun 28 08:08:57 + 2010
[coordinates] =>
[contributors] =>
[in_reply_to_screen_name] =>
[truncated] =>
[in_reply_to_status_id] =>
[place] =>
[geo] =>
[id] => 17236419253
[text] => Mau ntn apa Chiil? RT @chiilmill: Mampus XXI
penuh bener :((
)

[favourites_count] => 0
[verified] =>
[profile_text_color] => 00
[screen_name] => endryningtyas
[lang] => en
[time_zone] =>
[created_at] => Thu Mar 18 02:50:42 + 2010
[profile_link_color] => ff
[profile_background_image_url] => 
http://s.twimg.com/a/121427/images/themes/theme1/bg.png
[following] =>
[profile_sidebar_fill_color] => e0ff92
[protected] =>
[profile_background_tile] =>
[name] => itnayaz
[statuses_count] => 147
[profile_sidebar_border_color] => 87bc44
[url] => http://itnayaz.com
[id] => 124050687
[notifications] =>
[profile_use_background_image] => 1
[utc_offset] =>
[followers_count] => 18
)
-
but now I'm using it at php framework, cakePHP...and the result is
-
stdClass Object (
 [request] => /1/account/verify_credentials.json?
oauth_consumer_key=UnSVVvFuXqOX5AbUlyDAsQ&oauth_nonce=65a61e5b9cc47fa86c0f4ba1bc6783c2&oauth_signature=mAb
%2FkorJIukQf8pzCjP5ygBBGEM%3D&oauth_signature_method=HMAC-
SHA1&oauth_timestamp=1278575649&oauth_version=1.0 [error] => Could not
authenticate you. )
-

what's wrong with my code?

Please, help me ^_^..

thanks before


Re: [twitter-dev] Re: Current TwitterOAuth API won't display authorization page

2010-05-28 Thread Abraham Williams
Try switching

$to->OAuthRequest( "https://twitter.com/statuses/update.xml";, array('status'
=> $expanded_txt, 'POST') );

to:
$to->format = 'xml';
$to->post( "statuses/update", array('status' => $expanded_txt));

Abraham

On Tue, May 11, 2010 at 15:43, Jonathan  wrote:

> I'm afraid I spoke to soon. Things are not quite working.
>
> I am able to authorize tweeting through the new API, but I am not able
> to tweet yet.
>
> When I first tried, I got back a message from this tweet operation:
>
>   $to->OAuthRequest( "https://twitter.com/statuses/update.xml";,
>  array('status' => $expanded_txt, 'POST') );
>
> which said,
>
>Warning:  Missing argument 3 for TwitterOAuth::oAuthRequest(),
> called in ... and defined in .../twitterOAuth.php on line 178
>
> I looked at the code and concluded that the third parameter should be
> NULL. I added that and got this from PHP:
>
>Notice:  Array to string conversion in .../OAuth.php on
> line 373
>
> and from the tweet call:
>
>Could not authenticate you.
>
> Oauth.php lines 373 says
>
>return strtoupper($this->http_method);
>
> I traced the value in http_method back to the second parameter of
> twitterOAuth::oAuthRequest. I saw that instead of returning an array
> which contained, among other things, the scalar 'POST', the second
> parameter should just be 'POST'.
>
> Accordingly, I changed the call to:
>
>   $to->OAuthRequest( "https://twitter.com/statuses/update.xml";,
>  'POST', NULL );
>
> and got a return value that contained this:
>
>Client must provide a 'status' parameter with a value. error>
>
> ...which makes perfect sense, since the "status" element of the array
> contains the text of the tweet!
>
> I'm not sure what's happening here. It appears that one part of the
> code requires OAuthRequest's second parameter to be an array, and
> another part requires it to be a scalar! I know that can't be so, but
> I don't see what it wants. Again, I'm stymied by the lack of API
> documentation.
>



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


[twitter-dev] Re: Current TwitterOAuth API won't display authorization page

2010-05-11 Thread Jonathan
I'm afraid I spoke to soon. Things are not quite working.

I am able to authorize tweeting through the new API, but I am not able
to tweet yet.

When I first tried, I got back a message from this tweet operation:

   $to->OAuthRequest( "https://twitter.com/statuses/update.xml";,
  array('status' => $expanded_txt, 'POST') );

which said,

Warning:  Missing argument 3 for TwitterOAuth::oAuthRequest(),
called in ... and defined in .../twitterOAuth.php on line 178

I looked at the code and concluded that the third parameter should be
NULL. I added that and got this from PHP:

Notice:  Array to string conversion in .../OAuth.php on
line 373

and from the tweet call:

Could not authenticate you.

Oauth.php lines 373 says

return strtoupper($this->http_method);

I traced the value in http_method back to the second parameter of
twitterOAuth::oAuthRequest. I saw that instead of returning an array
which contained, among other things, the scalar 'POST', the second
parameter should just be 'POST'.

Accordingly, I changed the call to:

   $to->OAuthRequest( "https://twitter.com/statuses/update.xml";,
  'POST', NULL );

and got a return value that contained this:

Client must provide a 'status' parameter with a value.

...which makes perfect sense, since the "status" element of the array
contains the text of the tweet!

I'm not sure what's happening here. It appears that one part of the
code requires OAuthRequest's second parameter to be an array, and
another part requires it to be a scalar! I know that can't be so, but
I don't see what it wants. Again, I'm stymied by the lack of API
documentation.


[twitter-dev] Re: Current TwitterOAuth API won't display authorization page

2010-05-11 Thread Jonathan
On May 10, 1:08 pm, Abraham Williams <4bra...@gmail.com> wrote:
> It is because you are using the faster Sign in With Twitter endpoint where
> if a user has already authorized your application they will automatically
> redirect back to your site. If you want the user to always get prompted use
> $connection->getAuthorizeURL($token, FALSE);

Thanks. I tried that, and it worked.

One more question: how could I have figured this out without asking?

The comment block on twitterOAuth::getAuthorizeURL doesn't explain the
second parameter at all. I got your twitterOAuth documentation from
docs.google.com (I think through a link in the Twitter API Google
Group), but it describes the beta code, and I now know that it omits
the critical fact that I needed. Also, it's a brief outline of the
sequence of API calls -- useful in its own right, but it can't contain
the level of detail that I'd need to solve a problem like this one.