0

Vimeo アルバムからすべてのビデオの配列を取得しようとしています。vimeo の JS API を使用します。

https://developer.vimeo.com/apis/simple#album-request

したがって、上記のドキュメントでは、vimeo アルバムに関する情報にアクセスするには、次のような URL を作成すると述べています。

http://vimeo.com/api/v2/album/album_id/request.output

私の場合、そのURLは次のようになります。

$id2 = $_POST['alb1']

http://vimeo.com/api/v2/album/$id2/info.php

したがって、上記の URL を使用して vimeo が提供する .php ファイルを読み取るには、CURL を使用するように誰もが言います。

そこから、アルバム内のビデオの総数を取得する必要があります。

その数を使用して、すべてのビデオ (アルバムがある限り) にアクセスし、ビデオ URL でいっぱいの配列として保存するループを作成する必要があります。

次に、それが SQL データベースに保存され、データベースがループで読み取られて<li>、ビデオの画像を含む行が印刷されます。

ここで非アクションですべてを参照してください。

http://s199881165.onlinehome.us/transfem/newlayout/getal.php

vimeoファイルを読むために使用するphpは次のとおりです

function getVimeoInfo($id, $info) 
{

    if (!function_exists('curl_init')) die('CURL is not installed!');
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://vimeo.com/api/v2/album/$id/videos.php");
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    $output = unserialize(curl_exec($ch));
    $output = $output[0][$info];
    curl_close($ch);                
    return $output;                             

}


function getVimeoInfo2($id2, $info2) 
{

    if (!function_exists('curl_init')) die('CURL is not installed!');
    $ch2 = curl_init();
    curl_setopt($ch2, CURLOPT_URL, "http://vimeo.com/api/v2/album/$id2/info.php");
    curl_setopt($ch2, CURLOPT_HEADER, 0);
    curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch2, CURLOPT_TIMEOUT, 10);
    $output2 = unserialize(curl_exec($ch2));
    $output2 = $output2[0][$info2];
    curl_close($ch2);               
    return $output2;                                

}

他の部分は次のとおりです。

    $thetoatslotzes = getVimeoInfo2($posty_alby,'total_videos');
    echo "<script> alert('lotze: " . $thetoatslotzes . "');</script>" ; 


    $albarray =     getVimeoInfo($_POST['alb1'],'url');
    echo "<script> alert('albarray: " . $thetoatslotzes . "');</script>" ; 



      $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

      $dbh->beginTransaction();

      $dbh->exec("TRUNCATE TABLE vim_playlist12");
                $dbh->commit();


      $i = 0;

      while($i < 9) {
      $eye_matee =  $i + 1; 

      $dbh->beginTransaction();

      $dbh->exec("insert into vim_playlist12 (url, listnum) values 
      ($albarray[$i], $eye_matee)");

      $i = $i + 1; 

        $dbh->commit();
      }




       $seleccion = 'SELECT url, listnum FROM vim_playlist12 ORDER BY listnum';
foreach ($dbh->query($seleccion) as $row) {
    print $row['listnum'] . ": " . $row['url'] . "<br>" ;

}

    } 
    catch (Exception $e) {
      $dbh->rollBack();
      echo "Failed: " . $e->getMessage();
    }

}
else 
{}

最終的に、vimeo の videos.php から URL の配列を取得できれば、私はうまくいくでしょう。

4

0 に答える 0