Jump to content

Twitpic API 2 Upload and Post


i_am_turner

Recommended Posts

Hi all, I've got a bit of a problem with the Twitpic Api v2 upload. I'll post my code below. The picture with the message uploads to Twitpic, but it's not being posted to Twitter. Anyone have any ideas or experience with this? Thanks.

 



<?php

include 'EpiCurl.php';
include 'EpiOAuth.php';
include 'EpiTwitter.php';
include 'secret.php';

require 'class-xhttp-php/class.xhttp.php';

xhttp::load('profile,oauth');
$arvin = new xhttp_profile();

$arvin->oauth($consumer_key, $consumer_secret, $_COOKIE['oauth_token'], $_COOKIE['oauth_token_secret']);

// Generate OAuth Header
$authorization = $arvin->get_oauth_header('https://api.twitter.com/1/account/verify_credentials.json');

$data = array();
$data['headers'] = array(
'X-Auth-Service-Provider' => 'https://api.twitter.com/1/account/verify_credentials.json',
'X-Verify-Credentials-Authorization' => $authorization,
);

$data['post'] = array(
'key'    => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',  # Twitpic App API key
'message'=> $message,      # Twitter status
);

$data['files'] = array(
'media'  => $image_url,
);

$response = xhttp::fetch('http://api.twitpic.com/2/upload.xml', $data);

if($response['successful']) {
echo $response['body'];
} else {
print_r($response);		
}

?>



Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.