Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6894015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:43:48+00:00 2026-05-27T06:43:48+00:00

I just started playing around with the Twitter Streaming API and using the command

  • 0

I just started playing around with the Twitter Streaming API and using the command line, redirect the raw JSON reponses to a file using the command below:

curl https://stream.twitter.com/1/statuses/sample.json -u USER:PASSWORD -o "somefile.txt"

Is it possible to stay completely within R and leverage RCurl to do the same thing? Instead of just saving the output to a file, I would like to parse each response that is returned. I have parsed twitter search results in the past, but I would like to do this as each response is received. Essentially, apply a function to each JSON response.

Thanks in advance.

EDIT: Here is the code that I have tried in R (I am on Windows, unfortunately). I need to include the reference to the .pem file to avoid the error. However, the code just “runs” and I can not seem to see what is returned. I have tried print, cat, etc.

download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem")
getURL("https://stream.twitter.com/1/statuses/sample.json", 
       userpwd="USER:PWD",
       cainfo = "cacert.pem")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:43:49+00:00Added an answer on May 27, 2026 at 6:43 am

    I was able to figure out the basics, hopefully this helps.

    #==============================================================================
    # Streaming twitter using RCURL
    #==============================================================================
    library(RCurl)
    library(rjson)
    
    # set the directory
    setwd("C:\\")
    
    #### redirects output to a file
    WRITE_TO_FILE <- function(x) {
    
         if (nchar(x) >0 ) {
              write.table(x, file="Twitter Stream Capture.txt", append=T, row.names=F, col.names=F)
         }
    
    }
    
    ### windows users will need to get this certificate to authenticate
    download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem")
    
    ### write the raw JSON data from the Twitter Firehouse to a text file
    getURL("https://stream.twitter.com/1/statuses/sample.json", 
           userpwd=USER:PASSWORD,
           cainfo = "cacert.pem", 
           write=WRITE_TO_FILE)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jruby-1.5.3 with a rails 2.3.5 app. I've just started playing around with
I'm using a QTMovie to play audio tracks. I've just started playing around with
I just started using OrmLite so I am playing around with it. I have
I just started playing around with JSON and I have created this example. var
I have just started playing around with using Dojo in Zend Framework and things
I just started playing around with threading today and I ran into something that
I just started playing around with the 960 CSS framework and found that it
I'm just started on playing around with the canvas HTML5-object. For the sake of
I'm just getting started with ASP.NET MVC 2, and playing around with Validation. Let's
I just started playing around with WPF today, and I couldn't find the datagridview

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.