搜一搜

PHP专用破解图片防盗链支持图片下载

在线评论 01080
古典技术
作者:古典

发布时间:2021-08-25来源:古典技术网

破解图片防盗链工具
该文件放入任意支持php环境的网站下即可访问使用,不依赖于任何框架

使用方式传入远程图片地址例如:
/img.php?url=https://www.baidu.com/img/flexible/logo/pc/result.png

<?php
error_reporting(E_ERROR | E_PARSE );
@ini_set('max_execution_time', '0');
@ini_set("memory_limit",'-1');
$url = $_GET["url"];
if (!empty($url) && substr($url,0,4)=='http') {
	$dir = pathinfo($url);
	$host = $dir['dirname'];
	$ext = $dir['extension'];
	$refer = $host.'/';
	$ch = curl_init($url);
	curl_setopt ($ch, CURLOPT_REFERER, $refer);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
	curl_setopt($ch, CURLOPT_TIMEOUT, 30);
	curl_setopt($ch, CURLOPT_HEADER,0);
	curl_setopt($ch, CURLOPT_POST, 0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
	curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
	$data = @curl_exec($ch);
	curl_close($ch);
	$types = array(
		'gif'=>'image/gif',
		'jpeg'=>'image/jpeg',
		'jpg'=>'image/jpeg',
		'jpe'=>'image/jpeg',
		'png'=>'image/png',
	);
	$type = $types[$ext] ? $types[$ext] : 'image/jpeg';
	header("Content-type: ".$type);
	echo $data;
}

新建文件保存为img.php即可,文件就不提供下载了,很简单

标签: 防盗链 PHP 破解 盗链 图片

转载请注明出处:古典技术网

本页地址:https://www.gu90.com/phpcode/129.html

站住!留下神评!
相关文章
暂无相关信息