通过url获取图片

如何获取新浪,腾讯的图片文件?

http://www.test.com/img.php?src=这里填任意加密后的图片地址或防盗链的图片地址

以上是一个读取任何图片的链接,经处理后的图片地址支持被在线采集。

以下是测试:

新浪博客图片:

腾讯空间图片:

实现方法:

<?php

header("Content-type: image/PNG");

$src = 'http://photo.store.qq.com/http_imgload.cgi?/rurl2=e8e1b2fbbeb97d75c6e2901eddd41d123d0286d80b706a260b1f94b8e76e9620ac40e00605c5a35ea94c1986a88885d83a52eb3374e8aa300be47a50dbe2a9e3a9da76f742c55e8828e67f084dfb1f619693f48f';

$url = !empty($_GET['src']) ? $_GET['src'] : $src ;

$img = file_get_contents($url)

echo $img;

?>

随机文章:

1、PHP新特性Trait使用方法和冲突解决方法
https://www.onexin.net/php-trait-usage-method-conflict-resolution/

2、CentOS 5.3快速搭建Apache+PHP5+MySQL完美Web服务器(LAMP)
https://www.onexin.net/centos-5-3-quickly-build-the-perfect-apache-php5-mysql-web-server-lamp/

3、DX无后缀名图片下载,后缀名指(.jpg/.gif)
https://www.onexin.net/dx-extension-picture-download-extension-means-jpg-gif/

4、[推荐]成功人生需要“十商”(MQ|IQ|EQ|AQ|DQ|FQ|MQ|WQ|SQ|HQ)
https://www.onexin.net/recommended-to-succeed-in-life-need-to-10-business-mq-iq-eq-aq-dq-fq-mq-wq-sq-hq/

5、PHP 检测手机浏览器的代码
https://www.onexin.net/php-code-to-detect-mobile-browser/

转载请注明出处:https://www.onexin.net/get-image-by-url/

Leave a Reply

Your email address will not be published. Required fields are marked *