Curl twitter timeout linux


#1

hi guys…I am beginner , so please bear with me.
I am trying to fetch status using curl command.I have created app and have keys and secret keys.
I am hitting using below curl command. but it is giving timeout.do I need to add more.I tried to search over net about it, but nothing came out.

curl --get ‘https://api.twitter.com/1.1/statuses/user_timeline.json’ --data ‘count=10&screen_name=twitterapi’ --header ‘Authorization: OAuth oauth_consumer_key=“ZtpLGXXXX”, oauth_nonce=“9bd01XXXXXXXX”, oauth_signature=“qkwhbSTXXXXXXX”, oauth_signature_method=“HMAXXX”, oauth_timestamp=“1417520634”, oauth_token=“2915XXXXXXXXXXXX”, oauth_version=“1.0”’ --verbose

output is :

  • Adding handle: conn: 0x81894d8
  • Adding handle: send: 0
  • Adding handle: recv: 0
  • Curl_addHandleToPipeline: length: 1
    • Conn 0 (0x81894d8) send_pipe: 1, recv_pipe: 0
  • Trying X.X.X.X…
  • Connected to api.twitter.com (X.X.X.X) port 443 (#0)
  • successfully set certificate verify locations:
  • CAfile: none
    CApath: /etc/ssl/certs
  • SSLv3, TLS handshake, Client hello (1):
    } [data not shown]
    0 0 0 0 0 0 0 0 --:–:-- 0:05:00 --:–:-- 0
  • Closing connection 0
    curl: (28) Operation timed out after 300455 milliseconds with 0 out of 0 bytes r

Thanks in advance.


#2

Are you able to ping api.twitter.com? what’s the ping time?
Is the time on your system set correctly?


#3

Time is correct at my end. and ping is working correctly.
output is below :
PING api.twitter.com (199.16.156.40) 56(84) bytes of data.
64 bytes from 199.16.156.40: icmp_seq=1 ttl=237 time=391 ms
64 bytes from 199.16.156.40: icmp_seq=2 ttl=237 time=435 ms


#4

Another option would be to take a look at twurl, which is similar to curl but is custom-built for interacting with the Twitter API.


#5

does twitter also check for ca certification if request is coming from linux?


#6

when i tried to install twurl using given link it gave me following error :

%sudo gem i twurl --source http://rubygems.org
Fetching: oauth-0.4.7.gem (100%)
Successfully installed oauth-0.4.7
Fetching: twurl-0.9.2.gem (100%)
Successfully installed twurl-0.9.2
WARNING: Unable to pull data from ‘https://rubygems.org/’: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
2 gems installed

I think it is related to some certification.is it? or am i missing something?


#7

Looks like this could be a CA certificate issue (referencing this thread on Github, although it mostly talks about OS X).

I’d suspect that this might be at the core of your issue, also your initial curl shows it using SSLv3 which Twitter no longer supports.


#8

i downloaded cert.pem from this link :
http://curl.haxx.se/ca/cacert.pem

and then i used twitter api from this link for php :

but still it is giving timeout issue. why is not it giving descriptive error or am i doing very obvious stupid mistake ?