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
https://forums.phpfreaks.com/topic/236247-twitpic-api-2-upload-and-post/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.