How to Bypass anti-Leech protection in php

Source: Internet
Author: User
How to Bypass anti-Leech protection in php

  1. Script window. SC = ""; script

2. curl method usage:

  1. Http: // your-domain-name/showpic. php? Url = image_url

3. the PHP header sends download file names of various types: showpic. php

  1. $ Url = $ _ GET ["url"];
  2. // $ Url = str_replace ("http:/", "http: //", $ url );
  3. $ Dir = pathinfo ($ url );
  4. $ Host = $ dir ['dirname'];
  5. $ Refer = $ host .'/';
  6. $ Ch = curl_init ($ url );
  7. Curl_setopt ($ ch, CURLOPT_REFERER, $ refer );
  8. Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true); // activate the modifiable page, Activation can modify the page
  9. Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
  10. Curl_setopt ($ ch, CURLOPT_BINARYTRANSFER, 1 );
  11. $ Data = curl_exec ($ ch );
  12. Curl_close ($ ch );
  13. $ Ext = strtolower (substr (strrchr ($ img, '.'), 1, 10 ));
  14. $ Types = array (
  15. 'Gif' => 'image/GIF ',
  16. 'Jpeg '=> 'image/jpeg ',
  17. 'Jpg '=> 'image/jpeg ',
  18. 'Jpe' => 'image/jpeg ',
  19. 'PNG '=> 'image/png ',
  20. );
  21. $ Type = $ types [$ ext]? $ Types [$ ext]: 'image/jpeg ';
  22. Header ("Content-type:". $ type );
  23. Echo $ data;
  24. ?>

The error "Cannot modify header information headers already sent" is reported in PHP because no content is output before the code, including blank content. remember!

With the above code, you can display the image as follows:

It's really amazing. php image anti-Leech protection does not hold the defense line, haha.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.