Home · Latest · Trends  /  PHP
5

Upload favicon from external website

rated 5 times [  5] [ 0]  / comments: 0 / hits: 978  / 2 years ago, tue, feb 21, 2017, 02:06:26
Grabbing a Favicon from external website
<?php
$url = 'http://example.com';
$favicon = "https://www.google.com/s2/favicons?domain=".$url;
if($favicon == false) {
 $newimage = "0";
} else {
 $extension = "png";
 $time = date("ymdHis");
 $newimage = $time.".".$extension;
 $destination = "uploads/".$newimage;
 if(@file_put_contents($destination,file_get_contents($favicon))) {
  echo "true";
 } else {
  $newimage = "0";
 }
}
?>
More From » PHP
 

Comments

There are no comments for this Snippet yet
Only authorized users can post. Please sign in first, or register a free account
 
Share
Snippets
Smarty sort foreach results in Smarty file
3 years ago, sat, sep 10, 2016
Validate domain name with PHP gethostbyname
3 years ago, sat, sep 10, 2016
List all files in Zip archive with PHP
3 years ago, sat, sep 10, 2016
How to get the current url in smarty file
3 years ago, sat, sep 10, 2016
Sponsor
Posted
Michael

Michael

Member since Sep 10, 2016
Total Code Snippets: 5
Total Comments: 0
Location: n/a
Following
User not following anyone yet.