Php implements code sharing of Baidu online drive images
Require_once ('Snoopy. class. php ');
- // Http://www.abc.com/bdp.php? Consumer id = 29160 & uk = 2855065916
- $ Url = 'http: // pan.baidu.com/#/link? Upload id = '. $ _ GET ['upload id'].' & uk = '. $ _ GET ['UK'];
- $ Snoopy = new Snoopy ();
- $ Snoopy-> read_timeout = 0;
- $ Snoopy-> fetch ($ url );
- $ N = $ snoopy-> results;
- $ Regex = '/(_. src = ") (. + )(";)/';
- $ Match = '';
- Preg_match ($ regex, $ n, $ match );
If (preg_match ('/. gif/', $ match [2]) {
- Header ("Content-type: image/gif ");
- Imagegif (imagecreatefromgif ($ match [2]);
- } Elseif (preg_match ('/. jpg/', $ match [2]) {
- Header ("Content-type: image/jpeg ");
- Imagejpeg (imagecreatefromjpeg ($ match [2]);
- } Elseif (preg_match ('/. png/', $ match [2]) {
- Header ("Content-type: image/png ");
- Imagepng (imagecreatefrompng ($ match [2]);
- } Elseif (preg_match ('/. wbmp/', $ match [2]) {
- Header ("Content-type: image/vnd. wap. wbmp ");
- Imagewbmp (imagecreatefromwbmp ($ match [2]);
- } Else {}
- ?>
Snoopy. class. php is a php class used to imitate the functions of a web browser. it can complete the tasks of obtaining webpage content and sending forms. Search and download this file by yourself. The above file requires a space that supports PHP. Baidu online storage uploads images and publishes shares. after obtaining the share address, the consumer id = 29160 & uk = 2855065916 parameter. Use http: // your domain name/bdp. php? Upload id = 29160 & uk = 2855065916 to get the image. this address can be used in the CKEditor Image address. Other editors should also be supported. Directly use :. |