PHP implementation of the network album Picture anti-theft chain Perfect Crack method

Source: Internet
Author: User
Tags curl explode header http request php programming string format trim


This article describes the implementation of the PHP network photo album anti-theft chain Perfect Way to crack. Share to everyone for your reference. Specifically as follows:



Network photo album anti-theft chain crack Procedures-PHP version of this anti-theft chain cracked version can be perfect to crack the current more popular: Baidu albums, NetEase albums,can also achieve a simple picture anti-theft chain. Because this class is to get the remote image first, and then send the picture to the client, so that is carried out two traffic flow. Therefore, will waste space flow, next, will develop the caching function, this can realize saves the traffic!



?


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26-27--28 29---30 31--32 33 34 35 36 37 38-39 40 41 42 4 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 85, 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 1 19 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148-149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179-1 80 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209-210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240-2 41 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270-271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307-3 08 309 310 311 312 313 314 <?php/** * Network photo album anti-theft chain Crack Program-PHP Version * * Use method: * * Http://yourdomain/url.php?url=http://hiphotos.baidu.com/verdana/pic/ite m/baidupicture.jpg&referer= * Where the URL refers to the need to crack the picture URL, and Referer is to be compatible with some do not need to set the routing name to display the album,  must set the route for the normal browsing. Therefore, you should set Referer to 1 * * @author Snow Fox Blog * @version 1.0 * @since July * @URL http://www.xuehuwang.com/class Frivoll ER {/** * http version number (1.0, 1.1), Baidu uses version 1.1 * * @var String */protected $version;/** * Data in response to HTTP request * * @var Word string format */protected $body; /** * need to get the remote URL * * * @var string format/protected $link; /** * An array that containing any of the various components of the URL. * * @var array/protected $components; /** * HTTP Request host Data * * @var string/protected $host; /** * The path of required file. * (e.g. '/verdana/abpic/item/mygirl.png ') * * @var String */protected $path; /** * The HTTP referer, extra it from original URL * * @var String */protected $referer; /** * The HTTP method, "get" for Default * * @var String */protected $method = ' Get '; /** * The HTTP port, for default * * @var int */protected $port = 80; /** * Timeout period on a stream * * @var int */protected $timeout = 100; /** * The filename of image * * @var String */protected $filename; /** * The ContentType of image file. * Image/jpeg, Image/gif, image/png, image * * @var String */protected $contentType; /** * Frivoller Constructor * * @param string $link/Public function __construct ($link, $referer = ') {$this->referer = $referer; Parse the HTTP link $this->parselink ($link); Begin to fetch the image $stream = Pfsockopen ($this->host, $this->port, $errno, $errstr, $this->timeout); if (! $stream) {header ("Content-type: $this->contenttype;"); Echo $this->curlget ($link); else{fwrite ($stream, $this->buildheaders ()); $this->body = ""; $img _size = Get_headers ($link, true); while (!feof ($stream)) {$this->body. = Fgets ($stream, $img _size[' content-length ');//fwrite ($jpg, Fread ($stream, $ img_size[' content-length '));$content = Explode ("Rnrn", $this->body, 2); $this->body = $content [1]; Fclose ($stream); Send ' ContentType ' header for saving this file correctly///If no CT is sent, IE7 error (800700DE)//Flock when trying to save the picture, Firefox does not There is this problem, Opera does not test header ("Content-type: $this->contenttype;"); Header ("cache-control:max-age=315360000"); Echo $this->body; Save Picture//file_put_contents (' hello.jpg ', $this->body); }/** * Compose HTTP Request Header * * @return String */Private Function buildheaders () {$request = "$this->method $this->path Http/1.1rn "; $request. = "Host: $this->hostrn"; $request. = "Accept-encoding:gzip, Deflatern"; $request. = "user-agent:mozilla/5.0 (Windows; U Windows NT 6.0; ZH-CN; rv:1.9.0.1) gecko/2008070208 Firefox/3.0.1rn "; $request. = "CONTENT-TYPE:IMAGE/JPEGRN"; $request. = "Accept: */*rn"; $request. = "Keep-alive:300rn"; $request. = "Referer: $this->refererrn"; $request. = "Cache-control:max-age=315360000rn"; $request. = "Connection:closernrn"; RetUrn $request; /** * Strip Initial header and filesize info */Private Function Extractbody (& $body) {//the status of link if (STRP OS ($body, ' OK ') > 0) {//Strip header $endpos = Strpos ($body, "rnrn"); $body = substr ($body, $endpos + 4);//Stri P filesize at Nextline $body = substr ($body, Strpos ($body, "RN") + 2); }/** * Extra the HTTP URL * * @param $link/Private Function Parselink ($link) {$this->link = $link; $this->com ponents = Parse_url ($this->link); $this->host = $this->components[' host ']; $this->path = $this->components[' path ']; if (Empty ($this->referer)) {$this->referer = $this->components[' scheme ']. '://' . $this->components[' host ']; }elseif ($this->referer = = ' 1 ') {$this->referer = ';} $this->filename = basename ($this->path); Extract the content type $ext = substr (STRRCHR ($this->path, '. '), 1); if ($ext = = ' jpg ' or $ext = = ' jpeg ') {$this->contenttype = ' image/pjpeg ';} elseif ($ext = = ' gif ') {$this-&GT;contenttype = ' image/gif '; } elseif ($ext = = ' png ') {$this->contenttype = ' image/x-png ';} elseif ($ext = = ' bmp ') {$this->contenttype = ' imag E/bmp '; else {$this->contenttype = ' Application/octet-stream ';}} Crawl Web content function Curlget ($url) {$url = Str_replace (' & ', ' & ', $url); $curl = Curl_init (); curl_setopt ($curl, Curlopt_url, $url); curl_setopt ($curl, Curlopt_header, false); curl_setopt ($curl, Curlopt_referer, $url); curl_setopt ($curl, Curlopt_useragent, "mozilla/4.0" (compatible; MSIE 6.0; seaport/1.2; Windows NT 5.1; SV1; infopath.2) "); curl_setopt ($curl, Curlopt_cookiejar, ' cookie.txt '); curl_setopt ($curl, Curlopt_cookiefile, ' cookie.txt '); curl_setopt ($curl, Curlopt_returntransfer, 1); curl_setopt ($curl, curlopt_followlocation, 0); $values = curl_exec ($curl); Curl_close ($curl); return $values; /** * Obtains root domain name * * @author Lonely * @create 2011-3-11 * @version 0.11 * @lastupdate Lonely * @package Sl/class Rootdom ain{private static $self; private $domain =null; Private $host =null; Private $state _domain; Private $top _domain; /** * Get Domain name Analysis instance * Enter description here ... */public static function Instace () {if (!self:: $self) Self:: $self =new self (); Return self:: $self; The Public Function __construct () {$this->state_domain=array (' al ', ' dz ', ' af ', ' ar ', ' ae ', ' aw ', ' om ', ' az ', ' eg ', ' et ', ' Ie ', ' ee ', ' ad ', ' ao ', ' ai ', ' ag ', ' at ', ' au ', ' Mo ', ' BB ', ' pg ', ' BS ', ' PK ', ' py ', ' ps ', ' bh ', ' pa ', ' BR ', ' by ', ' BM ', ' BG ', ' MP ', ' BJ ', ' being ', ' is ', ' PR ', ' ba ', ' pl ', ' bo ', ' BZ ', ' bw ', ' BT ', ' BF ', ' bi ', ' bv ', ' KP ', ' gq ', ' dk ', ' de ', ' tl ', ' TP ', ' TG ', ' DM ', ' do ', ' Ru ', ' ec ', ' er ', ' fr ', ' fo ', ' pf ', ' gf ', ' tf ', ' V a ', ' ph ', ' fj ', ' fi ', ' CV ', ' FK ', ' GM ', ' CG ', ' CD ', ' Co ', ' Cr ', ' GG ', ' gd ', ' GL ', ' Ge ', ' cu ', ' GP ', ' gu ', ' Gy ', ' KZ ', ' ht ', ' kr ', ' nl ', ' an ', ' HM ', ' hn ', ' ki ', ' DJ ', ' kg ', ' gn ', ' GW ', ' CA ', ' gh ', ' ga ', ' kh ', ' cz ', ' ZW ', ' cm ', ' QA ', ' ky ', ' km ', ' ci ', ' kw ', ' cc ', ' hr ', ' ke ', ' ck ', ' lv ', ' ls ', ' la ', ' lb ', ' lt ', ' LR ', ' ly ', ' Li ', ' re ', ' Lu ', ' RW ', ' Ro ', ' mg ', ' im ', ' mv ', ' Mt ', ' MW ', ' my ', ' ml ', ' mk ', ' MH ', ' MQ ', ' yt ', ' mu ', ' Mr ', ' US ', ' um ', ' as ', ' VI ', ' mn ', ' Ms ', ' BD ', ' pe ', ' FM ', ' mm ', ' MD ',' Ma ', ' MC ', ' mz ', ' mx ', ' nr ', ' np ', ' ni ', ' ne ', ' ng ', ' nu ', ' No ', ' nf ', ' na ', ' za ', ' aq ', ' GS ', ' EU ', ' pw ', ' pn ', ' pt ', ' JP ', ' SE ', ' ch ', ' SV ', ' ws ', ' Yu ', ' sl ', ' SN ', ' cy ', ' SC ', ' sa ', ' cx ', ' st ', ' sh ', ' kn ', ' LC ', ' sm ', ' pm ', ' VC ', ' lk ', ' sk ', ' si ', ' sj ', ' sz ', ' SD ', ' SR ', ' SB ', ' so ', ' TJ ', ' tw ', ' th ', ' tz ', ' to ', ' TC ', ' TT ', ' tn ', ' TV ', ' tr ', ' TM ', ' TK ', ' wf ', ' vu ', ' GT ', ' ve ', ' bn ', ' ug ', ' UA ', ' uy ', ' uz ', ' es ', ' eh ', ' gr ', ' HK ', ' SG ', ' NC ', ' NZ ', ' Hu ', ' sy ', ' JM ', ' am ', ' ac ', ' ye ', ' iq ', ' ir ', ' il ', ' it ', ' in ', ' ID ', ' UK ', ' VG ', ' io ', ' Jo ', ' vn ', ' zm ', ' je ', ' TD ', ' GI ', ' cl ', ' CF ', ' cn ', ' yr '; $this->top_domain=array (' com ', ' arpa ', ' edu ', ' gov ', ' int ', ' mil ', ' net ', ' org ', ' biz ', ' info ', ' pro ', ' name ', ' museum ' , ' Coop ', ' aero ', ' xxx ', ' IdV ', ' m e ', ' mobi '); $this->url=$_server[' Http_host ']; /** * Set URL * Enter description here ... * @param string $url/Public Function SetUrl ($url =null) {$url = $url? $url: $this ->url; if (empty ($url)) return $this; if (!preg_match ("/^http:/is", $url)) $url = "http://". $url; $url =parse_url (Strtolower ($url)); $urlarr =explode (".", $url [' Host ']); $count =count($urlarr); if ($count <=2) {$this->domain= $url [' Host '];} else if ($count >2) {$last =array_pop ($urlarr); $last _1=array_pop ($urlarr); if (In_array ($last, $this->top_domain ) {$this->domain= $last _1. $last; $this->host=implode ('. ', $urlarr); }else if (In_array ($last, $this->state_domain)) {$last _2=array_pop ($urlarr); if (In_array ($last _1, $this->top_ Domain) {$this->domain= $last _2. $last _1. $last; $this->host=implode ('. ', $urlarr); }else{$this->host=implode ('. ', $urlarr). $last _2 $this->domain= $last _1. $last; }} return $this; /** * Get Domain name * Enter description here ... */public Function GetDomain () {return $this->domain;}/** * Get host * Enter de scription here ... * * Public Function GetHost () {return $this->host;}} $referer = Array (' xuehuwang.com ', ' zangbala.cn ', ' qianzhebaikou.net ', ' sinaapp.com ', ' 163.com ', ' sina.com.cn ', ' Weibo.com ', ' abc.com '); Get the URL, maybe your should check the given URL if (isset ($_get[' url ')) and $_get[' URL '!=') {//get antecedents $site = (isset ($_server[' http_referer ')) &&!empty ($_server[' http_referer '])? $_server[' Http_ REFERER ']: "; Match is a picture link if (Preg_match (HTTP|HTTPS|FTP|RTSP|MMS):(//|) {1} ((W) +[.]) {1,} ([a-za-z]| [0-9] {1,3}) (s*/) ((S) +[.] {1} (gif|jpg|png|bmp)) /I ', $_get[' url ']) {if (!empty ($site)) {$tempu = Parse_url ($site); $host = $tempu [' host ']; $root = new Rootdomain (); $root- >seturl ($site); if (In_array ($root->getdomain (), $referer)) {$img _referer = (isset ($_get[' referer ']) &&!empty ($_get[') Referer '])? Trim ($_get[' referer ']): '; New Frivoller ($_get[' url '), $img _referer); }else{$img _referer = (isset ($_get[' referer ')) &&!empty ($_get[' referer '))? Trim ($_get[' referer ']): '; new F Rivoller ($_get[' url '), $img _referer); }}}?>


I hope this article will help you with your PHP programming.


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.