2012-04-04 11 views
1

tweetbotのカスタムメディアアップロードサービスを行った。画像は正常にアップロードされ、URLは返され、tweetbotによって投稿されます。私はビデオをアップロードしようとすると、しかし、それはURLを取得しないが、これは起こる:ラックスペースへのビデオのアップロードが失敗し、画像が表示されない

http://c0728267.cdn2.cloudfiles.rackspacecloud.com/1333560894-movie.mp4

は、トップ上のテキストの前に画像を注目してください?しかしそれはビデオだ。何が間違っているのですか?ここで

は、アップロードプロセス解決

$oauthecho = new TwitterOAuthEcho(); 
$oauthecho->userAgent = 'dpkgme test app'; 
$oauthecho->setCredentialsFromRequestHeaders(); 

if ($oauthecho->verify()) {  

// Verification was a success, we should be able to access the user's Twitter info from the responseText. 
$userInfo = json_decode($oauthecho->responseText, true); 
$twitterId = isset($userInfo['id']) ? $userInfo['id'] : null; 


        $tweet = $_POST['message']; 

        error_reporting(E_ALL); 
        ini_set('display_errors', 1); 

        // include the API 
        require("cloudfiles.php") ; 

        // cloud info 
        $username = ''; // username 
        $key ='' ; // api key 
        $container = ''; // container name 

        ob_start(); 


        $localfile = $_FILES['media']['tmp_name']; 
        $filename = $_FILES['media']['name']; 
        $nf = time().'-'.$filename; 


        ob_flush(); 

        // Connect to Rackspace 
        $auth = new CF_Authentication($username, $key); 
        $auth->authenticate(); 
        $conn = new CF_Connection($auth); 

        // Get the container we want to use 
        $container = $conn->create_container($container); 

        // store file information 

        ob_flush(); 

        // upload file to Rackspace 
        $object = $container->create_object($nf); 
        $object->load_from_filename($localfile); 

        $uri = $container->make_public(); 
        //print "Your URL is: " . $object->public_uri(); 

        $imagePageUrl = $object->public_uri(); 


        ob_end_flush(); 


$link = 'http://c0728267.cdn2.cloudfiles.rackspacecloud.com/'.$nf ; 

$shortenedurl = file_get_contents('http://gl.gy/index.php?url='.$link); 
$keys = parse_url($shortenedurl); // parse the url 
    $path = explode("/", $keys['path']); // splitting the path 
    $last = end($path); // get the value of the last element 


    echo '<mediaurl>http://gl.gy/'.$last.'</mediaurl>'; 

答えて

0

ためのコードです。コンテンツタイプの検出を追加しました。今はうまくいきます。

関連する問題