Ver Mensaje Individual
  #6 (permalink)  
Antiguo 25/03/2012, 04:43
Avatar de ShuyithoKruz
ShuyithoKruz
 
Fecha de Ingreso: marzo-2012
Ubicación: Tijuana
Mensajes: 40
Antigüedad: 12 años, 1 mes
Puntos: 3
Respuesta: obtener metatags open graph de una web

Espero que les funcione

Código PHP:
libxml_use_internal_errors(true);
$c file_get_contents("http://url/here");
$d = new DomDocument();
$d->loadHTML($c);
$xp = new domxpath($d);
foreach (
$xp->query("//meta[@property='og:title']") as $el) {
    echo 
$el->getAttribute("content");
}
foreach (
$xp->query("//meta[@property='og:description']") as $el) {
    echo 
$el->getAttribute("content");