Para el caso de utilizar las funciones nativas de PHP sería:
<?PHP
$html = file_get_contents('http://foroblackhat.com/');
preg_match('/<title>(.*)<\/title>/i', $html, $title);
$title_out = $title[1];En este caso estamos sacado el Título de una URL que le hemos pasado la función file_get_contents que nos devuelve el HTML de esa URL.
Si quieres trabajar con una librería más potente te recomiendo Curl por defecto suele venir ya instalada. El código sería:
<?PHP
function get_content_url($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8');
 
    $data = curl_exec($ch); 
    curl_close($ch);
 
    return $data;
}
$html = get_content_url('http://foroblackhat.com/');
preg_match('/<title>(.*)<\/title>/i', $html, $title);
$title_out = $title[1];Como puedes ver en esta nos deja meter más parámetros como puede ser el User Agent y demás. Si quieres conocer todas las posibilidades de esta librería que es muy potente te recomiendo la web oficial de PHP:
http://www.php.net/manual/es/book.curl.php
 
						

 


 
	![[Imagen: firma_script_3_en_1.jpg]](http://s9.postimg.org/uin2usoi7/firma_script_3_en_1.jpg)
 Grupo Telegram
                Grupo Telegram
