Here is a vine video example https://vine.co/v/bjHh0zHdgZT. How can I get only it's description?
Let's say I have id of the video which is bjHh0zHdgZT and I need to get vine's description for my PHP based website.
Thanks.
Here is a vine video example https://vine.co/v/bjHh0zHdgZT. How can I get only it's description?
Let's say I have id of the video which is bjHh0zHdgZT and I need to get vine's description for my PHP based website.
Thanks.
Maybe you can parse the meta tag of the page ?
Source of vine page :
<meta property="twitter:card" content="player">
<meta property="twitter:title" content="Jethro Ames's post on Vine">
<meta property="twitter:description" content="SquareVine 1 #howto #favthings #loop">
To get the description from php with file_get_contents and preg_match :
<?php
$url = "https://vine.co/v/bjHh0zHdgZT";
$data = file_get_contents($url);
preg_match('~<\s*meta\s+property="(twitter:description)"\s+content="([^"]*)~i', $data, $matches);
print_r($matches);
if ( isset($matches[2]) ) {
$description = $matches[2];
}
?>
Output :
Array
(
[0] => <meta property="twitter:description" content="SquareVine 1 #howto #favthings #loop
[1] => twitter:description
[2] => SquareVine 1 #howto #favthings #loop
)
Your description is $matches[2]. Be careful to control this content (html entities, sql escape, etc.)