Go Down

Topic: I WANT THIS TOPIC TO BE DELETED, PLEASE (Read 3775 times) previous topic - next topic

elHombreGer

Feb 18, 2013, 07:02 pm Last Edit: Jan 29, 2015, 03:32 pm by elHombreGer
I WANT THIS TOPIC TO BE DELETED, PLEASE

danieljay

I have a fully functional setup you're describing on the Raspberry Pi. Here's a link to a demo video of it working :http://vimeo.com/61256196

Email me at: danbertner(@)gmail(dot).com if you need help and want to go in this direction.

johnwasser

It's the two newlines in a row that signals the end of headers:
Code: [Select]
client.println("HOST: api.twitter.com");
client.println();

To add more headers, change the first .println() to .print() and add a new .println() after your headers:
Code: [Select]
client.print(F("GET /1/statuses/user_timeline.json?&screen_name=tuitduino&count=1 HTTP/1.1"));
client.print(F("HOST: api.twitter.com"));
client.print(F("Authorization: OAuth oauth_consumer_key=\"cCB46H0y6R8Hrx836WwAA\", oauth_nonce=\"18106fa9ce0b1083367cfbd50720abea\", oauth_signature=\"XXXXXXXXXXXXXXXXXXXXXXX\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1361444134\", oauth_token=\"1004705586-tF4876Qu6qTwLMuTaCjbZCLTbFt4hDoRoCun3qW\", oauth_version=\"1.0\""));
client.println();
client.println();


Also note the use of backslash to put quote characters inside a string constant.

Also not the use of the F() macro to keep those long string constants from taking up room in precious SRAM.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

nizarr

hi,
i need to know how to coleck the parameters that you use in this code( autorization header);increasingly have to take those from the page developers twitter; ther is an important note ( in api page of twitter); OAuth signing results
Important: This will only be valid for a few minutes. Also remember the cURL command will actually execute the request.

so have you try realy the code on this example( i did but it doesn`t work, i had no reponse):
making HTTP request...
HTTP/1.1 400 Bad Request
Content-Length: 0
Connection: close
when i use :   client.print(F("GET /1.1/statuses/user_timeline.json?screen_name=plantaexpre&count=1 HTTP/1.1"));
   
Code: [Select]
client.print(F("Host:api.twitter.com"));
    client.print(F("Authorization: OAuth oauth_consumer_key=\"j3UCRhGsBZSfRltac4zEXg\", oauth_nonce=\"XXXXXXXXXXXXXXXXXXXXXXX\", oauth_signature=\"XXXXXXXXXXXXXXXXXXXXXX\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1364306703\", oauth_token=\"*********************************************\", oauth_version=\"1.0\""));
    //client.println("Connection:close");
    client.println();
    client.println();


have you try this code with anther  Twitter APi v1.1 ???

SurferTim

You are not sending a cr/lf with those. Use client.println() instead of .print().
Quote
when i use :   client.print(F("GET /1.1/statuses/user_timeline.json?screen_name=plantaexpre&count=1 HTTP/1.1"));


This is how the server sees your request, and this would be bad.
Code: [Select]
GET /1.1/statuses/user_timeline.json?screen_name=plantaexpre&count=1 HTTP/1.1Host:api.twitter.comAuthorization: OAuth oauth_consumer_key="j3UCRhGsBZSfRltac4zEXg", oauth_nonce="XXXXXXXXXXXXXXXXXXXXXXX", oauth_signature="XXXXXXXXXXXXXXXXXXXXXX", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1364306703", oauth_token="*********************************************", oauth_version="1.0"


nizarr

hi,

thanks for the note
i have try with println() and the reponse was the error 404 that means : the requested format is not supported by the requested method.

so ther is some help to use API v1.1 with the oauth

┬┐should i use a library for the authentication?
and how can i get nonce parametre and signature, because the values from twitter developers page  will only be valid for a few minutes?
my application should connect automatically; but with this methode i will give the application (in the arduino scketh) all the parametres it need, and the nonce parameters is only for a unique access..
any help please.

ther is another post for oauth http://arduino.cc/forum/index.php/topic,156599.0.html

SurferTim

Error 404 means "file not found". According to your code, this one:
api.twitter.com/1.1/statuses/user_timeline.json

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy