PHP Classes

Shiki PHP Proxy Request to Another Server: Retrieve and zip a file from a remote server

Recommend this page to a friend!
  Info   View files Example   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 107 All time: 9,653 This week: 94Up
Version License PHP version Categories
shikiproxy 1.0.0The PHP License5HTTP, PHP 5, Files and Folders, Compr...
Description 

Author

This package can be used to retrieve and zip a file from a remote server.

It can take a given URL of a file in a remote server and retrieves its contents.

The class can compress the file in ZIP format and serves it for download.

Innovation Award
PHP Programming Innovation award winner
February 2020
Winner
Some people need to be able to access certain pages or files that are available on a remote Web server.

However, some times they are working on environments that have restricted access to the Internet, like for instance companies that impose access restrictions to the sites they can access.

This package provides a workaround solution that allows retrieving files from any site using an intermediate site running this class and serve the desired file compressed as a ZIP archive.

Manuel Lemos
Picture of Chouchen
  Performance   Level  
Name: Chouchen <contact>
Classes: 5 packages by
Country: France France
Age: ???
All time rank: 259770 in France France
Week rank: 91 Up5 in France France Up
Innovation award
Innovation award
Nominee: 3x

Winner: 2x

Example

<?php
if(isset($_POST['url']) && isset($_POST['method'])){
   
   
$file2zip = new FileToZip(filter_input(INPUT_POST, 'url', FILTER_VALIDATE_URL));
   
   
$method = filter_has_var(INPUT_POST, 'method') ? is_array($_POST['method']) ? $_POST['method'] : array($_POST['method']) : null;
   
   
$fileDispatcher = new FileToZipDispatcher($method, $file2zip->build());
   
   
$options = $_REQUEST;
    unset(
$options['method']);
    unset(
$options['url']);
   
   
$fileDispatcher->dispatch($options);
   
    if(!
in_array('toDownloadNow', $method)){
       
header('Location: '.BASE_URL);
        exit;
    }
}else{
   
header('Location: '.BASE_URL);
}


Details

I needed a proxy because downloading exe files is forbidden at work.

Zipped file aren't.

To use it, just enter the file's URL, choose "download now" or/and "download later" For the first option, the download will start immediatly. For the other one, an email will be asked, the script will send a link to the zipped file so you can download it later. Once clicked, the link will be useless. It only works once.

To configure it, modify:

define('BASE_URL', 'http://mywebsite.com');

in index.php

RewriteBase /

in .htaccess

mail('email', ...);

in FileToZipEmail.php

Contact : http://shikiryu.com/contact


  Files folder image Files  
File Role Description
Accessible without login Plain text file .htaccess Data Auxiliary data
Accessible without login Plain text file download.php Example Example script
Plain text file FileToZip.php Class Class source
Plain text file FileToZipDispatcher.php Class Class source
Plain text file FileToZipEmail.php Class Class source
Accessible without login Plain text file index.html Data Download file page
Accessible without login Plain text file index.php Aux. Auxiliary script
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file shortcut.php Example Example script
Plain text file ToDownloadIndex.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:107
This week:0
All time:9,653
This week:94Up