Baidu space picture anti-theft chain crack program-PHP version

Source: Internet
Author: User
Tags header http request php code php source code
Baidu | procedure | anti-theft chain | crack upload Baidu Pictures can not be quoted from the outside, so many friends hurt their brains, Verdana the students developed a crack program, you can use a section of PHP code to solve this problem. Local empty IE cache after the test success, because there is no host, so there is no test on the Internet, conditional friends can help test, thank you! If you are interested in this program on the basis of continuing to optimize the improvement

The following is the PHP source code.

/**
* Baidu Space photo album anti-theft chain crack Procedures-PHP version
*
* Use method:
*
*


*
* @author Verdana
* @version 1.0
* @since July 16, 2006
*/
Class Frivoller
{
/**
* The HTTP version (1.0, 1.1), Baidu use version 1.1
*
* @var String
*/
protected $version;
/**
* The HTTP response body
*
* @var String
*/
protected $body;

/**
* The HTTP URL
*
* @var String
*/
protected $link;
/**
* An array this containing any of the various components of the URL.
*
* @var Array
*/
protected $components;
/**
* The HTTP Host
*
* @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)
{
Parse the HTTP link
$this->parselink ($link);
Begin to fetch the image
$stream = Fsockopen ($this->host, $this->port, $errno, $errstr, $this->timeout);
if (! $stream) Die ("ERROR: $errno-$errstrn");
Fputs ($stream, $this->buildheaders ());
$this->body = "";
while (!feof ($stream)) {
$this->body. = Fgets ($stream, 4096);
}
Extract picture data
$this->extractbody ($this->body);
Send ' ContentType ' header for saving this file correctly
If you do not send CT, the IE7 error occurs when you try to save the picture (800700DE)
Flock, Firefox does not have this problem, Opera did not test
Header ("Content-type: $this->contenttype");
Print $this->body;
Save this picture
File_put_contents (' hello.jpg ', $this->body);
Fclose ($stream);
}
/**
* Compose HTTP Request Header
*
* @return String
*/
Private Function Buildheaders ()
{
$request = "$this->method $this->path http/1.1rn";
$request. = "Host: $this->hostrn";
$request. = "CONTENT-TYPE:IMAGE/JPEGRN";
$request. = "Accept: */*rn";
$request. = "Keep-alive:300rn";
$request. = "Connection:closern";
$request. = "Referer: $this->refererrn";
$request. = "Cache-control:max-age=315360000rnrn";
return $request;
}
/**
* Strip Initial header and filesize info
*/
Private Function Extractbody (& $body)
{
The status of link
if (Strpos ($body, ' OK ') > 0) {
Strip header
$endpos = Strpos ($body, "rnrn");
$body = substr ($body, $endpos + 4);
Strip FileSize at nextline
$body = substr ($body, Strpos ($body, "RN") + 2);
}
}
/**
* Extra the HTTP URL
*
* @param $link
*/
Private Function Parselink ($link)
{
$this->link = $link;
$this->components = Parse_url ($this->link);
$this->host = $this->components[' host '];
$this->path = $this->components[' path '];
$this->referer = $this->components[' scheme '. '://' . $this->components[' host '];
$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->contenttype = ' image/gif ';
}
ElseIf ($ext = = ' png ') {
$this->contenttype = ' image/x-png ';
}
ElseIf ($ext = = ' bmp ') {
$this->contenttype = ' image/bmp ';
}
else {
$this->contenttype = ' Application/octet-stream ';
}
}
}
Get the URL and maybe you should check the given URL
if (isset ($_get[' url ')) and $_get[' url ']!= ') {
New Frivoller ($_get[' url '));
}
?>

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.