p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: How do they do this?


Message #1 by "John" <dotsyntax@r...> on Sat, 2 Feb 2002 23:40:29
Go to http://www.php.net/downloads.php.



How do they process the php script on another document, without changing 

the current document in browser memory or referencing the same document 

i.e. $PHP_SELF? Pay attention, the link is passing a query to a document 

called 'do_downloads.php'.
Message #2 by "Hermawan Haryanto" <hermawan@h...> on Sun, 3 Feb 2002 06:50:12 +0700
Dear sir,

Do you know why your current address on your browser is change ? because it

success load the page which you redirecting to. If the page you gonna visit

is only doing a download an application or something, then the page it self

never been successfully loaded to the browser [maybe you'll confuse of my

word]. But the script it self already processed and the result is

downloading the application/document. That's why your browser address is not

change.



Thanks

Hermawan Haryanto







----- Original Message -----

From: "John" <dotsyntax@r...>

To: "beginning php" <beginning_php@p...>

Sent: Saturday, February 02, 2002 11:40 PM

Subject: [beginning_php] How do they do this?





> Go to http://www.php.net/downloads.php.

>

> How do they process the php script on another document, without changing

> the current document in browser memory or referencing the same document

> i.e. $PHP_SELF? Pay attention, the link is passing a query to a document

> called 'do_downloads.php'.




$subst('Email.Unsub').

>



Message #3 by "Nikolai Devereaux" <yomama@u...> on Sat, 2 Feb 2002 18:59:31 -0800

This exact same question was asked on this forum not too long ago...



I don't think anyone posted the "actual" answer, but I posted a guess.



---- do_downloads.php ----

<?php

    header("Location: $download_file");

?>

--------------------------



That's it.  This is assuming that the file to be downloaded is in the same

directory as the PHP or HTML page calling it.  If not, just make sure the

header redirect knows the path to the $download_file.



This works because your browswer realizes that it's not an HTML file that

it's receiving, and pulls up the download dialog.  If download_file was an

mp3, it might have very well started winamp or whatever.



Enjoy,



nik













-----Original Message-----

From: John [mailto:dotsyntax@r...]

Sent: Saturday, February 02, 2002 11:40 PM

To: beginning php

Subject: [beginning_php] How do they do this?





Go to http://www.php.net/downloads.php.



How do they process the php script on another document, without changing

the current document in browser memory or referencing the same document

i.e. $PHP_SELF? Pay attention, the link is passing a query to a document

called 'do_downloads.php'.




$subst('Email.Unsub').



Message #4 by "John" <dotsyntax@r...> on Mon, 4 Feb 2002 20:05:24
The header( ) function does seem to work. But from what I have read in the 

PHP documentation I get the impression that there is a lot more to this 

function.



Aside from the PHP documentation, can anyone give me a tip on where I can 

find more, comprehensive, information on the function?
Message #5 by "Nikolai Devereaux" <yomama@u...> on Mon, 4 Feb 2002 12:09:37 -0800

The header function is very well documented at PHP.net's manual, imnsho.  If

you want to know what values you can send as header information, you should

follow the link to the HTTP 1.1 spec and read up on it.



in all my PHP experience, I've used header() for anything but a std http

redirect.



Some people that use PHP to output WML for cell phones sometimes use the

Header function to force the content type to "text/vnd.wap.wml" instead of

the default text/html.



nik



p.s. http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.10





> -----Original Message-----

> From: John [mailto:dotsyntax@r...]

> Sent: Monday, February 04, 2002 8:05 PM

> To: beginning php

> Subject: [beginning_php] RE: How do they do this?

>

>

> The header( ) function does seem to work. But from what I have

> read in the

> PHP documentation I get the impression that there is a lot more to this

> function.

>

> Aside from the PHP documentation, can anyone give me a tip on where I can

> find more, comprehensive, information on the function?




> $subst('Email.Unsub').




  Return to Index