Obtaining youtube embedded video code through php
<p>I am a new learner to php. I am trying to retrieve embeded information from youtube videos URLs.  I was originally following the code from this <a href="http://google.com" rel="nofollow">SITE</a> but unfortunately the author doesn't provide access to actual code. </p>

<p>I am having difficulties extracting the php variable values so that i can get the embedded video code. </p>

<p>The htmlentities echo is returning this error<code>syntax error, unexpected T_CONSTANT_ENCAPSED_STRING</code></p>

<p>source: <a href="http://google.com" rel="nofollow">SITE</a></p>

<pre><code>&lt;html&gt;
    &lt;form method="post" action=""&gt;
    URL:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
    &lt;input type="text" value="&lt;?php $vari ?&gt;" name="yurl"&gt; &lt;!--$vari--&gt;
    &lt;br&gt;
    &lt;br&gt;
    Height:&amp;nbsp;
    &lt;input type="text" value="&lt;?php $hth ?&gt;" name="yheight"&gt; &lt;!--$hth--&gt;
    &lt;br&gt;
    &lt;br&gt;
    Width:&amp;nbsp;&amp;nbsp;
    &lt;input type="text" value="&lt;?php $wdth ?&gt;" name="ywidth"&gt; &lt;!--$wdth--&gt;
    &lt;br&gt;
    &lt;br&gt;
    Autoplay:&amp;nbsp;
    &lt;input type="checkbox" value="&lt;?php $auto1; $auto2; ?&gt;" name="yautop"&gt;  &lt;!--$auto1 $auto2--&gt;
    &lt;br&gt;
    &lt;br&gt;
    &lt;input type="submit" value="Generate Embed Code" name="ysubmit"&gt;
    &lt;/form&gt;
&lt;/html&gt;
</code></pre>

<p><strong>php code for getting youtube url info</strong></p>

<pre><code>&lt;?php
$vari ='';
$step1 =explode ('v=', $vari);
$step2 =explode ('&amp;amp;',$step1[1]);

$auto1='?autoplay=1';

$auto2='&amp;autoplay=1';


//Iframe code with autoplay
echo htmlentities ('&lt;iframe src="http://www.youtube.com/embed/'.$step2[0].$auto1'"
frameborder="0" width="'.$wdth.'" height="'.$hth.'"&gt;&lt;/iframe&gt;';

//embed code with autoplay
echo htmlentities ('&lt;embed width="'.$wdth.'" height="'.$hth.'"
type="application/x-shockwave-flash" src="http://www.youtube.com/v/'.$step2[0].$auto2'"
wmode="transparent" embed="" /&gt;&lt;/embed&gt;');
?&gt;
</code></pre>
