コード例 #1
0
<?php

error_reporting(E_ALL & ~E_WARNING);
//To remove warning that are pre-existing in a site
extract($_POST);
set_time_limit(150);
session_start();
if (isset($submit)) {
    $title = "";
    //title of the page
    $image_src = "";
    //Src of a page
    $desc = "";
    //decription of a page in text
    $dom = new DOMdocument();
    $dom->loadHTMLFile($theUrl);
    if (strpos($theUrl, 'www.youtube.com/watch?v') !== false) {
        //echo "hi";
        foreach ($dom->getElementsByTagName("link") as $link_tag) {
            if ($link_tag->getAttribute('itemprop') == 'embedURL') {
                $image_src = $link_tag->getAttribute('href');
                break;
            }
        }
    }
    /** Image Array  **/
    $image_src_attr = array('link' => '1', 'aspect-ratio' => 10000);
    //Title of a page
    foreach ($dom->getElementsByTagName("meta") as $meta_ob) {
        //  echo"</br>"; for testing this code
        $meta_content = $meta_ob->getAttribute("content");
コード例 #2
0
  <input type="submit" name="submit" id="submit" value="Submit"></input>
</form>

<?php 
error_reporting(E_ALL & ~E_WARNING);
//To remove warning that are pre-existing in a site
extract($_POST);
set_time_limit(150);
$title = "";
//title of the page
$image_src = "";
//Src of a page
$desc = "";
//decription of a page in text
$dom = new DOMdocument();
$dom->loadHTMLFile($url);
if (strpos($url, 'www.youtube.com/watch?v') !== false) {
    //echo "hi";
    foreach ($dom->getElementsByTagName("link") as $link_tag) {
        if ($link_tag->getAttribute('itemprop') == 'embedURL') {
            $image_src = $link_tag->getAttribute('href');
            break;
        }
    }
}
/** Image Array  **/
$image_src_attr = array('link' => '1', 'aspect-ratio' => 10000);
//Title of a page
foreach ($dom->getElementsByTagName("meta") as $meta_ob) {
    //  echo"</br>"; for testing this code
    $meta_content = $meta_ob->getAttribute("content");