If you are familiar with Java, try Twitter4J.
The latest snapshot supports image upload with OAuth.
http://groups.google.com/group/twitter4j/browse_thread/thread/d548993dd3a4fc84

On 1月11日, 午前11:37, Andrew Arnott <andrewarn...@gmail.com> wrote:
> Still trying to post images to Twitter using OAuth unsuccessfully.  Can
> someone please help?
>
> My latest attempt is inline with what I can gather from other people who
> claim to do it successfully: put ALL parameters in the multipart entity and
> have a very simple OAuth signature base string:.
>
> The signature was constructed based on this signature base string:
>
> POST&http%3A%2F%2Ftwitter.com%2Faccount%2Fupdate_profile_image.xml&
>
> And here is the raw text I sent:
>
> POST /account/update_profile_image.xml HTTP/1.1
> Content-Type: multipart/form-data;
> boundary=2e280788-b8f5-4c5e-a05b-9be7ad76fac7
> User-Agent: DotNetOpenAuth/3.4.0.10010
> Host: twitter.com
> Cache-Control: no-store,no-cache
> Pragma: no-cache
> Content-Length: 20134
>
> --2e280788-b8f5-4c5e-a05b-9be7ad76fac7
> Content-Disposition: form-data; name="oauth_token"
>
> 14821025-bq1rTNjyfQrOtb181Alwt0UHPJTffxXDOahZtBrK8
> --2e280788-b8f5-4c5e-a05b-9be7ad76fac7
> Content-Disposition: form-data; name="oauth_consumer_key"
>
> ONxVX5b14DpiVGlprq1yA
> --2e280788-b8f5-4c5e-a05b-9be7ad76fac7
> Content-Disposition: form-data; name="oauth_nonce"
>
> zvj9dhYY
> --2e280788-b8f5-4c5e-a05b-9be7ad76fac7
> Content-Disposition: form-data; name="oauth_signature_method"
>
> HMAC-SHA1
> --2e280788-b8f5-4c5e-a05b-9be7ad76fac7
> Content-Disposition: form-data; name="oauth_signature"
>
> IKIkDXQC6JPELXTUv8oU7byaXSU=
> --2e280788-b8f5-4c5e-a05b-9be7ad76fac7
> Content-Disposition: form-data; name="oauth_version"
>
> 1.0
> --2e280788-b8f5-4c5e-a05b-9be7ad76fac7
> Content-Disposition: form-data; name="oauth_timestamp"
>
> 1263176820
> --2e280788-b8f5-4c5e-a05b-9be7ad76fac7
> Content-Disposition: form-data; name="image"; filename="thomas
> jefferson.jpg"
> Content-Type: image/jpg
> Content-Transfer-Encoding: binary
>
> <beginning of raw binary data>
> --2e280788-b8f5-4c5e-a05b-9be7ad76fac7
>
> --
> Andrew Arnott
> "I [may] not agree with what you have to say, but I'll defend to the death
> your right to say it." - S. G. Tallentyre
>
> On Sat, Jan 9, 2010 at 4:59 PM, Andrew Arnott <andrewarn...@gmail.com>wrote:
>
>
>
> > Can anyone from Twitter, or someone who's successfully done it with a
> > consumer library, please lay out the exact format of the HTTP request
> > Twitter expects for an OAuth-signed image upload?  By my reading the OAuth
> > spec allows several possibilities, assuming multi-part POST:
>
> >    1. Only the the image (and tile) parameters are in the POST entity.
> >     All the OAuth-specific parameters are in the HTTP Authorization header,
> >    thereby allowing them to be signed.
> >    2. All the parameters, OAuth ones and image ones, are in the POST
> >    entity, leaving nothing by the HTTP method and URL to be signed using the
> >    OAuth signature.
> >    3. The OAuth specific parameters appear in the query string of the POST
> >    url, and once again the image parameter appears in the POST entity.
>
> > Which of these does Twitter support?  I'm trying #1 without any success.
> >  Before investing in upgrading my library to support each of these
> > scenarios, I'd like to know which one will end up successful.  Right now I'm
> > getting Status 500 errors.
>
> > Thanks.

Reply via email to