Thread: Using libcurl to log into Twitter

  1. #1
    Registered User
    Join Date
    Dec 2015
    Posts
    11

    Question Using libcurl to log into Twitter

    Hello all. I attempted to make a program that logs into twitter programmatically using libcurl. My progress thus far:

    - retrieves HTML content from login page
    - fetches the authenticity code (cookie) from the pile of data

    I am stumped at the next step... using that authenticity token to POST a request for login. Is this possible to accomplish with libcurl + twitter?


    If so, how can I accomplish this?

    Example of token:
    authenticity_token=0e499692c4a7cad27f09d0b83aef779 9f0f75f0


    Thank you for any guidance!

  2. #2
    Registered User
    Join Date
    Dec 2015
    Posts
    11
    "Computer questions not related to C/C++/C# programming"

    why was my thread moved here...? :/

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Because you didn't post any C or C++ code.

    Download wireshark, and use it to understand how twitter works when using your browser.

    After that, it just seems to be reading some examples -> libcurl - source code examples
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Dec 2015
    Posts
    11
    Quote Originally Posted by Salem View Post
    Because you didn't post any C or C++ code.

    Download wireshark, and use it to understand how twitter works when using your browser.

    After that, it just seems to be reading some examples -> libcurl - source code examples
    I attempted to do that but failed miserably >.<
    I am not sure what I am looking for or how to filter so its twitter's packets only.
    I just get endless flow of packets when i run it

    If I'm not wrong I just need to figure out the post fields? How can I get the proper post format for twitter's login?
    The below is an example of how to set the post fields using libcurl:
    /* Now specify the POST data */
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "name=daniel&project=curl");
    Last edited by JohnDou; 12-15-2015 at 01:40 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. libcurl and Javascript
    By Rodaxoleaux in forum C++ Programming
    Replies: 6
    Last Post: 12-24-2011, 02:42 PM
  2. libcurl to file
    By starternewb in forum C Programming
    Replies: 1
    Last Post: 03-15-2011, 07:45 AM
  3. help with libcurl
    By ltcabral in forum C Programming
    Replies: 2
    Last Post: 03-27-2008, 01:05 PM

Tags for this Thread