473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

execute PHP -> return output to string

Hi

I've got a problem and I hope someone can help me:

I want a PHP script to call another PHP script, execute it and return its
OUTPUT (not its content) into a STRING in the first script.

--
_/_/ ICQ: 114034537 IRC : Robin479m (DALnet/EFnet)
_/ _/ Y! : Robin479m Mail: Ch***************@gmx.de
_/_/ AIM: Robin479m MSN : Ro*******@hotmail.com
Jul 17 '05 #1
4 10624
"Christopher-Robin" a écrit le 05/11/2003 :
Hi

I've got a problem and I hope someone can help me:

I want a PHP script to call another PHP script, execute it and return its
OUTPUT (not its content) into a STRING in the first script.


Don't really understand can't you use function() ?
Jul 17 '05 #2
See http://us3.php.net/manual/en/function.include.php

"Christopher-Robin" <Ch***************@gmx.de> wrote in message
news:bo*************@ID-157729.news.uni-berlin.de...
Hi

I've got a problem and I hope someone can help me:

I want a PHP script to call another PHP script, execute it and return its
OUTPUT (not its content) into a STRING in the first script.

--
_/_/ ICQ: 114034537 IRC : Robin479m (DALnet/EFnet)
_/ _/ Y! : Robin479m Mail: Ch***************@gmx.de
_/_/ AIM: Robin479m MSN : Ro*******@hotmail.com

Jul 17 '05 #3
Eric Ellsworth wrote:
See http://us3.php.net/manual/en/function.include.php


to clarify...
ob_start(); // start trapping output
include "foo.php"; // produce output
$output = ob_getcontents(); // get contents of trapped output
ob_end_clean(); // discard trapped output and stop trapping

cool thing is you can nest these too :)
you can do other things using a call-back. pretty funky stuff really :)

See "output buffering", check the spelling of those functions. I'm too
lazy to look it up...

Jul 17 '05 #4
> ...

ob_start(); // start trapping output
include "foo.php"; // produce output
$output = ob_getcontents(); // get contents of trapped output
ob_end_clean(); // discard trapped output and stop trapping

...


Exactly this is what I did so far before I realized, that the output buffer
is limited in size to 'output_buffering' in the php configuration, which is
set to 4096 bytes by default, but 4K is just not enough for me. I need it do
be unlimited. This could be done with 'output_buffering = On', which limits
the buffer to the RAM size for the script offered in 'memory_limit' (8M by
default).
PS: It must be done this way to make sure everything in the buffer before is
reinsert afterwards.

$old=ob_get_contents(); ob_clean(); ob_start(); // you may leave ob_start();
include ...;
$out=ob_get_contents(); ob_clean();
echo $old;
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jill Graham | last post by:
Hi, I'm using an access database and found following problem : I have a table X with 2 records : record 1 & record 2. I execute following procedure with 2 steps : 1. The procedure deletes...
6
by: PiGei | last post by:
hi all, I'm trying to use server.execute statement to include in an asp page another asp page with a parameter. That's because I've a parametric query in the second asp page and I have to pass...
3
by: Chris | last post by:
I have yet to understand or get a response on the issue I'm having. I'm taking an asp web application and migrating it from Windows 2K to 2003. I have the new website location (2003) settings...
2
by: Norman Fritag | last post by:
Hi there The below code executes some queries. As newbie I was wondering weather you are better of using connection execute or command execute to execute queries? I am asking as...
1
by: Jack Bauer | last post by:
How can I execute a query which prompt the user for input? Something like SELECT FROM Table WHERE Name= In Oracle PL/SQL, you use & before variable names to have the SQL*Plus ask for input....
8
by: johnlichtenstein | last post by:
I am using cx_Oracle and MySQLdb to pull a lot of data from some tables and I find that the cursor.execute method uses a lot of memory that never gets garbage collected. Using fetchmany instead of...
6
by: gyung | last post by:
Hi, this is my first post but I've been constantly referred to this site when I needed help. Anyway, this time I can't seem to find anything, so here goes. This is part of my case statement, and I...
9
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
3
by: RAG2007 | last post by:
I'm using the QueryDef and Execute method to update a record in my MySQL backend. Problem: When the Passthrough update query is defined using QueryDef, it becomes a select query, and I cannot use...
0
by: David | last post by:
- Are there any peculiarities with using curs.executemany(...) vs. multiple How many times are you calling execute vs a single executemany? The python call overhead will add up for thousands of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.