Jump to content

upuaut

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

upuaut's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I tested it at the prompt becuase the output from the browser has 2 empty lines - probably 2 nulls -  at the top (before I print any statement), and because I use the output as input to a javascript function.. which is making the behaviour intermittent. regardless, it's baffling me why the script works through the browser, but generates the mentioned error on command line. I'm wondering, what's the plumbing difference between the two? thanks.
  2. thanks for the reply. what i mean by question 3 (header in conjunction with a direct link) is the following:  the script figures which server to use for the download (this part works). then, to force download, the script does something like this: $file = "http://remote-server1.com/file1.wma"; // this script runs on this-server.com/blah header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); // or header("Content-Type: application/unknown"); ??????? header( "Content-Disposition: attachment; filename=".basename($file)); header( "Content-Description: File Transfer"); // @readfile($file); is no good here since $file is on another machine/server publicly available via http. SERVE_FILE($FILE) // the script now hands control to http protocol or some such and its job is done. I hope this helps elaborate what I'm trying to achieve. thanks in advance.
  3. I'm a little confounded. I have a simple script with a mysql_connect() call. On command line >> php script.php I get X-Powered-By: PHP/4.0.6 Content-type: text/html <br> <b>Fatal error</b>:  Call to undefined function:  mysql_connect() in <b>/home/somepath/lib/opendb.php</b> on line <b>2</b><br> and the script doesn't make any database changes. if I try from a browser http://somesite.com/script.php I get the expected output, and I get back data from tables the script uses and the tables that are expected to update some value do get updated. I created a scrip with phpinfo() in it, I get few mysql entries. I'm sure the connection to db is working since i can read/update tables. what gives? running on linux, php4.0.6, mysql 3.x thanks
  4. Is it possible to force header in conjunction with a direct link? (as I described in question 3)? thanks.
  5. Hi All, I'm new to php. Convinced of its performance advantage over perl, I decided to use it for my client's project. Background: the client outsourced the entire project to run on our website, with the media files hosted on other servers (initially one, potentially many if bandwidth demand dictates) on our website: the html pages, database storage, application code (php) What it is: the client offers DRM protected media files (copyrighted songs and lectures) for download. We are to track usage and dynamically generate download links for the media files from one/many servers publically available. We are not interested in protecting the paths to the download media files, and actually encourage direct links to downloads. the challenge: the files are in WMA/WMV format. When a user clicks on a link, they are to be prompted to save the file via "save/save as" dialog box, ie, force download , where the user gets prompted to the save dialog box in IE and firefox (and hopefully all browsers). Windows Media Player should not handle the download request. My findings: I could use the header() function and set content-type to application/unknown, among setting other header info. And I'd need to use the readfile(). the questions: 1- Say the client's server's pipe throughput is 6Mbps, and our server (where code is running), is a max of 1.5Mbps. Would that mean that the max speed a user gets when downloading is 1.5? ie, would our server be a bottleneck? 2- Technically, when readfile() is executed on our server, is it actually reading the remote file then piping the data to the end user?, ie, the file goes through like this remote_server -> our_server -> user's browser? My guess is yes, but would like to confirm with gurus. 3- Is there a way in php to simply serve the proper headers (to force download), then connect the user's browser to the download link (a public file) and leave the rest to http? What is not an option: we wouldn't consider compressing the files to zip format to work around the force download issue. Thanking you in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.