Thu, December 2, 2021
 
https://devcodepro.comdevcodepro
X
InterServer Web Hosting and VPS
Home · Latest · Trends
7

Upload favicon from external website

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";
 }
}
?>
rated 7 times (7) (0)
comments: 0 / hits: 2421  / 5 years ago, tue, feb 21, 17, 02:06:26
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
Login with Google
 
Share
Posted
Michael
Member since Sep 10, 2016
Total Code Snippets: 5
Total Comments: 0
Location: n/a
Michael snippets
5 years ago, sat, sep 10, 16, 3:07:57
comments: 2 / hits: 6050
PHP
5 years ago, sat, sep 10, 16, 3:13:33
comments: 0 / hits: 2971
PHP
5 years ago, sat, sep 10, 16, 3:16:20
comments: 0 / hits: 3056
PHP
5 years ago, sat, sep 10, 16, 3:19:13
comments: 1 / hits: 7058
PHP