2012-01-29 22 views
0

イム私のコードブロック内の行のテーマ/スケルトン/ページ-watch.php 117未定義のインデックスVimeoの

ライン117は、任意のアイデアをURLから動画のURLを取得し、またはデフォルト

を使用 //以下のコードを指し?多くのおかげで

<?php 
     function curl_get($url) { 
      // is cURL installed? If not die 
      if (!function_exists('curl_init')) die('cURL is not installed!'); 

      // Create new cURL resource handle 
      $curl = curl_init($url); 

      //Return or print out the data (1 = return, 0 = print) 
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 


     //Set Timeout in Seconds 
      curl_setopt($curl, CURLOPT_TIMEOUT, 30); 


     //Download the URL, and return the output 
      $output = curl_exec($curl); 

      // Close the cURL resources  
      curl_close($curl); 
      return 

     $output; 
      } 
     // Hard-coded endpoint 
     $oembed_endpoint = 'http://vimeo.com/api/oembed'; 
     // The Vimeo video to be embedded 
     $id = get_post_meta($post->ID, '_format_video_embed' , true); 
     // Get the video url from the url, or use default 
     $video_url = ($_GET['url']) ? $_GET['url'] : 'http://vimeo.com/' . $id; 
     // Create the url 
     $xml_url = $oembed_endpoint . '.xml?url=' . rawurlencode($video_url) . '&width=640'; 
     // Load in the oEmbed XML 
     $oembed = simplexml_load_string(curl_get($xml_url)); 
     ?> 
     <?php 
     // oEmbed Result 
     echo html_entity_decode($oembed->html); 
     ?> 
     <?php 
     echo $oembed->title 
     ?> 
     <?php 
     echo $oembed->author_name 
     ?> 
     <?php 
     echo $oembed->description 
     ?> 
     <?php endwhile; ?> 

答えて

0

使用

$video_url = isset($_GET['url']) ? $_GET['url'] : 'http://vimeo.com/' . $id; 

代わりの

$video_url = ($_GET['url']) ? $_GET['url'] : 'http://vimeo.com/' . $id; 

まずあなたはurl$_GETに存在を確認する必要があります。 isset機能になります。

関連する問題