get - PHP script to find Apple Touch Icon -


i have php script crawls page , extracts first image in page, isn't working well, , i'd rather no results ambiguous picture, possible modify following script extract universal url of first link rel="apple-touch-icon" or link rel="apple-touch-icon-precomposed"?

<?php if($_request['url']!='') { function get($a,$b,$c) { // gets string between 2 strings $y = explode($b,$a); $x = explode($c,$y[1]); return $x[0]; } $url=get_meta_tags("".$_request['url']."");  ?>  <div class="addsitetitle"><?php echo get(file_get_contents(''.$_request['url'].''), "<title>", "</title"); ?></div> <div class="addsitedescription"><?php echo ($url["description"]); ?></div> <div class="addsitekeywords"><?php echo ($url["keywords"]); ?></div> <div class="addsitecopyright"><?php echo ($url["copyright"]); ?></div> <div class="addsiteimage"><img <?php echo get(file_get_contents(''.$_request['url'].''), "<img", "/>"); ?> /></div> 

edited include function.

using this, can obtain links images code such as:

$html = file_get_html($url); $img = $html->find('img[rel=apple-touch-icon]'); echo $img->href; 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -