简体   繁体   中英

PHP file retrieval - web app?

I am about to start working on a small app written in php that will allow a user to click on a link & have that retrieve a file from a different website and deliver it to the user's browser without redirecting to the remote site [pdf files].

Before I started writing, I just thought I would check to see if anyone knew of anything out there that already does this.

what I'm looking to do:

  • log referrers
  • pass some kind of auth in the query string
  • push the file to the remote browser without redirecting.

* UPDATE * sorry I forgot tom mention, the sites with the links may not be running php, the site delivering the files will be the only site able to execute any kind of code.

thoughts or suggestions?

-thanks -sean

you can use curl in php :-).

Curl Manual

example straight from site:

Using PHP's cURL module to fetch the example.com homepage

<?php

$ch = curl_init("http://www.example.com/");
$fp = fopen("example_homepage.txt", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);
curl_close($ch);
fclose($fp);
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM