트위터에 상태 및 이미지를 게시하려고합니다. 상태는 트위터지만 이미지는 트위터가 아닙니다. 트윗에 대한트위터 상태지만 이미지가 아닙니다.
내 PHP 코드, 어떻게 미디어 포스트를 사용하여 이미지를 업로드하려면 지금
<?php
session_start();
require_once('twitteroauth/twitteroauth.php');
require_once('config-sample.php');
if (isset($_REQUEST['oauth_token']) && $_SESSION['oauth_token'] !== $_REQUEST['oauth_token']) {
$_SESSION['oauth_status'] = 'oldtoken';
header('Location: ./clearsessions.php');
}
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
$access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
$_SESSION['access_token'] = $access_token;
unset($_SESSION['oauth_token']);
unset($_SESSION['oauth_token_secret']);
if (200 == $connection->http_code) {
$_SESSION['status'] = 'verified';
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
$content = $connection->get('account/verify_credentials');
$image='abc.jpg';
$image1=file_get_contents($image);
$array_disp[0]=$image;
$connection->post('statuses/update',array('status' =>'hello123', 'media[]'=>$image1));
$response=$connection->response['response'];
} else {
header('Location: ./clearsessions.php');
}
입니까?