faqts : Computers : Programming : Languages : PHP : Database Backed Sites : Oracle

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

18 of 35 people (51%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

Can one PHP page call another PHP inside its block?

Apr 24th, 2004 07:40
Eyzen Medina, sheeta laputa,


Hi when you sais another block you are refering to another script file?

So i will give you my experience in that.

If your srcipt have to be necesary in another file you can use various 
method.

The include or require method like C you can include libraries, this 
automatically loads your php code and execute.
Browse the php help for more information.

Or use the function [file].

You can use this function for example, you need execute a script in 
another domain, like a Web Services.

$Ret_Values = file('http://www.mynewserver.com/myphp_page.php');

So in $Ret_Values you will get an array with each line of the executed 
script.

In the script file you can writte.

print 'Some Test\n\r';
print 'this work\n\r';

You will get in $Ret_Values

$Ret_Values[0] -- 'Some Test'
$Ret_Values[1] -- 'this work'

I used this a lot of.

The contra it's that's calling the script from a web server and you 
can't use sessions, cookies or other related clients usefull functions.
Because the call was made from your web server not for a browser client.


I hope tha's help you

Eyzen