PHP and Twitter API

Story of my programming life :slight_smile: Thanks I’ll put some work in tonight and see where I land.

you are suppose to decode it… not encode…

Anyone have thoughts on posting a retweet from PHP? Should something like this work? If so, how does twitter know what user is posting the tweet (there’s no login credentials). I’m lost!

[php]<?php

date_default_timezone_set(‘America/New_York’);
session_start();
require_once(“twitteroauth.php”); //Path to twitteroauth library

$twitteruser = “kkkkkkk”;
$consumerkey = “xxxxxxxx”;
$consumersecret = “xxxxxxxxxxxxxxx”;
$accesstoken = “xxxxxxxxxxxxxxxxx”;
$accesstokensecret = “xxxxxxxxxxxxxxx”;

function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
$connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
return $connection;
}

$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);

$connection->post(“https://api.twitter.com/1.1/statuses/retweet/380024993951653888.json”);

?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service