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开发者_Go百科 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);
?>
精彩评论