Sat, January 23, 2021
 
https://devcodepro.comdevcodepro
Home · Latest · Trends  /  PHP
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: 2056  / 4 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
 
Share
Posted
Michael
Member since Sep 10, 2016
Total Code Snippets: 5
Total Comments: 0
Location: n/a
Michael snippets
4 years ago, sat, sep 10, 16, 3:07:57
comments: 1 / hits: 4696
PHP
4 years ago, sat, sep 10, 16, 3:13:33
comments: 0 / hits: 2404
PHP
4 years ago, sat, sep 10, 16, 3:16:20
comments: 0 / hits: 2578
PHP
4 years ago, sat, sep 10, 16, 3:19:13
comments: 1 / hits: 5888
PHP