Does anyone know how to update the upload_with_media php code from the Matt Harris library (below) to include the Oauth_token and Oauth_token_secret from a sign-in page using the Abraham library? Both of the codes are working fine separately but adding the token and secret to the update_with_media php is proving difficult. Thanks
<?php
//start session
session_start();
//just simple session reset on logout click
if(isset($_GET[“reset”]) && $_GET[“reset”]==1)
{
session_destroy();
header(‘Location: ./forms/check.php’);
}
// Include config file and twitter PHP Library by Abraham Williams (abraham@abrah.am)
include_once(“config.php”);
include_once("…/twitteroauth.php");
?>
<?
require '.../tmhOAuth.php';
require '.../tmhUtilities.php';
if(isset($_SESSION['status']) && $_SESSION['status']=='verified')
{ //Success, redirected back from process.php with varified status.
//retrive variables
$screenname = $_SESSION['request_vars']['screen_name'];
$twitterid = $_SESSION['request_vars']['user_id'];
$oauth_token = $_SESSION['request_vars']['oauth_token'];
$oauth_token_secret = $_SESSION['request_vars']['oauth_token_secret'];
}
$tmhOAuth = new tmhOAuth(array(
'consumer_key' => 'XXXXX',
'consumer_secret' => 'XXXXX',
'user_token' => $oauth_token,
'user_secret' => $oauth_token_secret,
));
$params = array(
'image' => "@{$_FILES['image']['tmp_name']};type={$_FILES['image']['type']};filename={$_FILES['image']['name']}",
);
$code = $tmhOAuth->request(
'POST',
'https://upload.twitter.com/1/statuses/update_with_media.json',
array(
'media[]' => "@{$image};type=image/jpeg;filename={$image}",
'status' => " " . $status
),
true, // use auth
true // multipart
);
if ($code == 200) {
tmhUtilities::pr(json_decode($tmhOAuth->response['response']));
} else {
tmhUtilities::pr($tmhOAuth->response['response']);
}
?>