[PHP] Re: Passing variables with include()
include(http://www.someremote.server/calculate_drivers.php;); Very simple really: You cannot include remote files... --|-- Tino Didriksen http://ProjectJJ.dk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Passing variables with include()
Sure you can. Right out from the manual: If URL fopen wrappers are enabled in PHP (which they are in the default configuration), you can specify the file to be include()ed using an URL instead of a local pathname. See Remote files and fopen() for more information. best regards Stefan Rusterholz - Original Message - From: Tino Didriksen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 14, 2002 1:53 PM Subject: [PHP] Re: Passing variables with include() include(http://www.someremote.server/calculate_drivers.php;); Very simple really: You cannot include remote files... --|-- Tino Didriksen http://ProjectJJ.dk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Passing variables with include()
A lot of different answers, which I will respond to: - The variable is definately set before the include call is made, there is no doubt about that at all :) - Including remote files *is* possible. The php manual does not mention this does not work, and when I add the variable to the call (include /calculate_drivers?serie_id=3.php) the code is processed perfectly. The thing is, I can not pass the variable with the call, because it's value is determined by the form field. I could use a switch statement of course, but that adds a lot more text to the code. - I'm not sure changing the file extension will help (because the code in that remote php file has to be processed on the remote server, in order to be able to query the db), but I will give it a try. -- Imar de Vries - [EMAIL PROTECTED] - ICQ 6972439 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Passing variables with include()
Imar De Vries wrote: - Including remote files *is* possible. The php manual does not mention this does not work, and when I add the variable to the call (include /calculate_drivers?serie_id=3.php) the code is processed perfectly. The thing is, I can not pass the variable with the call, because it's value is determined by the form field. I could use a switch statement of course, but that adds a lot more text to the code. I just changed the code to (include .../calculate_drivers?serie_id=$serie_id.php) ... and this worked! Weird solution... -- Imar de Vries - [EMAIL PROTECTED] - ICQ 6972439 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Passing variables with include()
Imar De Vries wrote: Imar De Vries wrote: - Including remote files *is* possible. The php manual does not mention this does not work, and when I add the variable to the call (include /calculate_drivers?serie_id=3.php) the code is processed perfectly. The thing is, I can not pass the variable with the call, because it's value is determined by the form field. I could use a switch statement of course, but that adds a lot more text to the code. I just changed the code to (include .../calculate_drivers?serie_id=$serie_id.php) ... and this worked! Weird solution... Not really. The http://.../foo.php request returns html and not php. The foo.php file is parsed and executed by the remote server and returned to you as html. By adding serie_id=xxx you actually give the remote php-script the name and value of the variable. You should think of include/require as a way to *include* any file into your script. Instead of cutting and pasting code into your file, you use include. Thats the way it works in practice. No magic is going on here :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Passing variables with include()
Hi Al. While we are on topic, what are the key differences between include() require() ? Cheers Scott - Original Message - From: Martin Wickman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 14, 2002 3:40 PM Subject: [PHP] Re: Passing variables with include() Imar De Vries wrote: Imar De Vries wrote: - Including remote files *is* possible. The php manual does not mention this does not work, and when I add the variable to the call (include /calculate_drivers?serie_id=3.php) the code is processed perfectly. The thing is, I can not pass the variable with the call, because it's value is determined by the form field. I could use a switch statement of course, but that adds a lot more text to the code. I just changed the code to (include .../calculate_drivers?serie_id=$serie_id.php) ... and this worked! Weird solution... Not really. The http://.../foo.php request returns html and not php. The foo.php file is parsed and executed by the remote server and returned to you as html. By adding serie_id=xxx you actually give the remote php-script the name and value of the variable. You should think of include/require as a way to *include* any file into your script. Instead of cutting and pasting code into your file, you use include. Thats the way it works in practice. No magic is going on here :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Passing variables with include()
Since some time there has only one difference left (don't know at which version it changed): include causes a warning and require an error on fail. (very useful for debugging - require your error-handler and include everything else) best regards Stefan Rusterholz - Original Message - From: Scott Houseman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 13, 2002 2:54 PM Subject: Re: [PHP] Re: Passing variables with include() Hi Al. While we are on topic, what are the key differences between include() require() ? Cheers Scott - Original Message - From: Martin Wickman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 14, 2002 3:40 PM Subject: [PHP] Re: Passing variables with include() Imar De Vries wrote: Imar De Vries wrote: - Including remote files *is* possible. The php manual does not mention this does not work, and when I add the variable to the call (include /calculate_drivers?serie_id=3.php) the code is processed perfectly. The thing is, I can not pass the variable with the call, because it's value is determined by the form field. I could use a switch statement of course, but that adds a lot more text to the code. I just changed the code to (include .../calculate_drivers?serie_id=$serie_id.php) ... and this worked! Weird solution... Not really. The http://.../foo.php request returns html and not php. The foo.php file is parsed and executed by the remote server and returned to you as html. By adding serie_id=xxx you actually give the remote php-script the name and value of the variable. You should think of include/require as a way to *include* any file into your script. Instead of cutting and pasting code into your file, you use include. Thats the way it works in practice. No magic is going on here :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Passing variables with include()
Scott Houseman wrote: Hi Al. While we are on topic, what are the key differences between include() require() ? Unlike include(), require() will always read in the target file, even if the line it's on never executes. If you want to conditionally include a file, use include(). The conditional statement won't affect the require(). However, if the line on which the require() occurs is not executed, neither will any of the code in the target file be executed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Passing variables with include()
Scott Houseman wrote: Hi Al. While we are on topic, what are the key differences between include() require() ? Unlike include(), require() will always read in the target file, even if the line it's on never executes. If you want to conditionally include a file, use include(). The conditional statement won't affect the require(). However, if the line on which the require() occurs is not executed, neither will any of the code in the target file be executed. I'm pretty sure that at last for PHP 4.06 or higher this is deprecated. I don't know why it is still in the manual. Please correct me if I'm wrong. best regards Stefan Rusterholz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]