Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting embed code for specific vimeo video, vimeo API
    primarykey
    data
    text
    <p>Ok, working on a vimeo based video blog theme for wordpress and rather than lazily ask people to paste the embed code into each video update (via a custom field), I'd rather the user supplied just the video id... basically I can't guarantee that each video is going to be the same height / width so I'm trying to get the embed code directly from vimeo (rather than getting the user to supply) rather than hardcoding a height / width for the iframe (as the theme is going to be responsive and I'm using a small jquery script to resize the videos on the fly)</p> <p>So far, having tried to butcher Vimeo's own API example, I've got this:</p> <pre><code>function curl_get($url) { $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); $return = curl_exec($curl); curl_close($curl); return $return; } // Create the URL $oembed_vid_id = get_field('video_embed_code'); $oembed_url = 'http://vimeo.com/api/v2/video/' . $oembed_vid_id . '.xml'; // Load in the oEmbed XML $oembed = simplexml_load_string(curl_get($oembed_url)); $embed_code = html_entity_decode($oembed-&gt;html); &lt;?php echo $embed_code ?&gt; </code></pre> <p>But I get nothing back, have I overlooked something quite basic?</p> <p>I can confirm that the $oembed_url URL does exist, try any vimeo id and you'll see the relevant xml for it, i.e. here's a video I've plucked from vimeo:</p> <p><a href="http://vimeo.com/api/v2/video/48198301.xml" rel="nofollow">http://vimeo.com/api/v2/video/48198301.xml</a></p> <p>Would be fantastic if I could get to grips with this as I'll be able to pull down thumbnails etc. and make use of all that other lovely info tucked away in the xml file.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload