Aiuto funzione estrapolazione
-
Salve a tutti,
avrei un piccolo problemino
Ho questa funzione
$testo = $imag['textimg'];
$url = explode(' ',$http);
$url = str_replace("'" , " " , $url);
$urls = '.$url[0]; //questa è il tuo indirizzo estrapolato dal testo.preg_match("/<title>(.+)<\/title>/siU", file_get_contents($urls), $matches); $title = $matches[1]; $tags = get_meta_tags($urls); if(($url[0]) != ''){ $sites_html = file_get_contents($urls); $html = new DOMDocument(); @$html->loadHTML($sites_html); $meta_og_img = null; $meta_og_desc = null; //Get all meta tags and loop through them. foreach($html->getElementsByTagName('meta') as $meta) { //If the property attribute of the meta tag is og:image if($meta->getAttribute('name')=='description'){ //Assign the value from content attribute to $meta_og_img $meta_og_desc = $meta->getAttribute('content'); } if($meta->getAttribute('property')=='og:image'){ //Assign the value from content attribute to $meta_og_img $meta_og_img = $meta->getAttribute('content'); } } }//end ifma ho un problema che mi affligge..
La funzione funziona benissimo ma stranamente mi estrapola solo il meta og:image di youtube ma non altri link..(Ne avrò provati una 50ina)Come mai mi succede questo?
Grazie in anticipo a tutti..

Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi