snipt

Ctrl+h for KB shortcuts

PHP

Fetch/scrape flashvar value for movie location

<?
include 'simple_html_dom.php';
$html = new simple_html_dom();
$source = $_REQUEST['url'];
$html->load_file($source);

foreach($html->find('object param[name=flashvars]') as $flash_vars){
    $mp4_src = $flash_vars->value;
    echo $mp4_src;
}
?>
https://snipt.net/embed/b503515a03d552bdb270005fce86f91c/
/raw/b503515a03d552bdb270005fce86f91c/
b503515a03d552bdb270005fce86f91c
php
PHP
11
2019-06-25T16:44:13
True
False
False
/api/public/snipt/31230/
fetchscrape-flashvar-value-for-movie-location
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1"> 1</a> <a href="#L-2"> 2</a> <a href="#L-3"> 3</a> <a href="#L-4"> 4</a> <a href="#L-5"> 5</a> <a href="#L-6"> 6</a> <a href="#L-7"> 7</a> <a href="#L-8"> 8</a> <a href="#L-9"> 9</a> <a href="#L-10">10</a> <a href="#L-11">11</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?</span> </span><span id="L-2"><a name="L-2"></a><span class="k">include</span> <span class="s1">&#39;simple_html_dom.php&#39;</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a><span class="nv">$html</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">simple_html_dom</span><span class="p">();</span> </span><span id="L-4"><a name="L-4"></a><span class="nv">$source</span> <span class="o">=</span> <span class="nv">$_REQUEST</span><span class="p">[</span><span class="s1">&#39;url&#39;</span><span class="p">];</span> </span><span id="L-5"><a name="L-5"></a><span class="nv">$html</span><span class="o">-&gt;</span><span class="na">load_file</span><span class="p">(</span><span class="nv">$source</span><span class="p">);</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="k">foreach</span><span class="p">(</span><span class="nv">$html</span><span class="o">-&gt;</span><span class="na">find</span><span class="p">(</span><span class="s1">&#39;object param[name=flashvars]&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="nv">$flash_vars</span><span class="p">){</span> </span><span id="L-8"><a name="L-8"></a> <span class="nv">$mp4_src</span> <span class="o">=</span> <span class="nv">$flash_vars</span><span class="o">-&gt;</span><span class="na">value</span><span class="p">;</span> </span><span id="L-9"><a name="L-9"></a> <span class="k">echo</span> <span class="nv">$mp4_src</span><span class="p">;</span> </span><span id="L-10"><a name="L-10"></a><span class="p">}</span> </span><span id="L-11"><a name="L-11"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
dom, php