1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

POSTing to Twitter via php

Discussion in 'Social Networking Sites' started by r3dn4x, Mar 14, 2011.

  1. r3dn4x

    r3dn4x Newbie

    Joined:
    Jul 7, 2008
    Messages:
    29
    Likes Received:
    7
    I'm trying to POST a status update to twitter via curl, but I'm getting authentication errors. Is anyone doing this successfully? I don't want to use the API, just curl. I'm currently extracting the authenticity_token, but I'm still getting "could not authenticate". I'm posting to:

    http://api.twitter.com/1/statuses/update.json

    with form data:

    PHP:
        $postData = Array(
        
    'include_entities' => 'true',
        
    'status' => 'ohmyhagosh',
        
    'post_authenticity_token' => $token
        
    );
    This is still getting me authentication errors... anyone? Thanks
     
  2. Jalil

    Jalil Newbie

    Joined:
    Nov 1, 2010
    Messages:
    16
    Likes Received:
    3
    While waiting for a response from here you should try to post in phphelpforum too. those guys are realy good with coding.
     
  3. infinite411

    infinite411 Newbie

    Joined:
    Aug 5, 2008
    Messages:
    18
    Likes Received:
    0
    I used to use a php class I found on google. But it stopped working some time ago. I think the only way now is to use the new api.

    On August 16, 2010 the twitterapi team will be shutting off basic authentication on the Twitter API. All applications, by this date, need to switch to using OAuth. Read more

    I wrote a new (wrapper)class that uses OAuth for authentication, so grab your copy.
     
  4. r3dn4x

    r3dn4x Newbie

    Joined:
    Jul 7, 2008
    Messages:
    29
    Likes Received:
    7
    Yeah, I figure there has to be some workaround for grabbing tokens? I see apps like TweetAttacks claiming they are POSTing via web and not API... gotta be some way?
     
  5. sirgold

    sirgold Supreme Member

    Joined:
    Jun 25, 2010
    Messages:
    1,260
    Likes Received:
    645
    Occupation:
    Busy proving the Pareto principle right
    Location:
    A hot one
    Gotta start here for OAuth brother:

    Code:
    https://dev.twitter.com/apps/new
    and probably reading this will be beneficial:

    Code:
    http://teeky.org/web-development/writing-php-application-using-oauth-twitter-api/
    The best way to reuse code IMO is to borrow the php from a wp plugin called: "WP to Twitter" it'll get you accustomed to a lot of the hoops you have to jump thru. HTH.
     
  6. Autumn

    Autumn Elite Member

    Joined:
    Nov 18, 2010
    Messages:
    2,197
    Likes Received:
    3,041
    Occupation:
    I figure out ways to make money online and then au
    Location:
    Spamville
    If you choose to go through the regular web interface, then you have to send the right session cookies. Look at the cookies sent with Live HTTP Headers or Firebug. The authenticity_token isn't all you need.

    API sucks, both because you have to sign up for API accounts and because it is extremely easy for them to track you. API accounts get banned faster than non API accounts in my experience.

    I believe TweetAttacks makes it easy for themselves by implementing a Windows-esque full browser that executes javascript, but I haven't used the program so I could be wrong.
     
  7. lexblast

    lexblast Junior Member

    Joined:
    Jan 5, 2011
    Messages:
    118
    Likes Received:
    25
    I was considering using PHP to send twitter auto-updates from a site but I think at this point I may opt for just outputting an RSS feed for what I want to send and have tweet adder blast that out.

    I am sure I could get PHP->twitter to work, but for how long with their constant changes and also tweet adder solves the proxy/tracking issue.