Untitled Do***ent
works great john!!
PHP Code:
<?
if(isset($_POST['url'])){
$url = $_POST['url'];
$content = file_get_contents("$url");
preg_match('#<title>(.*?)</title>#', $content, $title);
$title = $title[1];
if(preg_match('#<link rel="shortcut" href="(.*?)"#', $content)){
preg_match('#<link rel="shortcut" href="(.*?)"#', $content, $shortcut);
}
if(preg_match('#<link rel="shortcut icon" href="(.*?)"#', $content)){
preg_match('#<link rel="shortcut icon" href="(.*?)"#', $content, $shortcut);
}
$shortcut = $shortcut[1];
$shortcut = ereg_replace("$url", '', $shortcut);
$titlelength = strlen($atitle);
if($titlelength > 17){
$shorttitle = substr($atitle,0,14);
$atitle = "$shorttitle...";
}
if(empty($shortcut)){
$shortcut = "No Shortcut Icon found";
}
$goto = str_replace("http", "", $url);
Echo "$url<br />$title<br />$shortcut";
}
?>
Thats my test code, am I using the ereg replace wrong? because if you type in toasted penguin, it still has 'http://toastedpenguin.com' in the shortcut text
Edit, I dont think that way is the best way to get the shortcut icon, I need to search for '.ico' and get the image that uses that extension somehow